PHP Knowledge Base Update -- July 10th, 1999
[email protected] (Nathan Wallace) Sun, 11 Jul 1999 08:56:47 -0500
| Newsgroups | php.kb |
|---|---|
| Message-ID | <[email protected]> |
Well, the response to the translation links seems to be pretty disappointing. I was quite surprized since I've found babelfish to be amazing in the past. Oh well, hopefully it will help some people understand the answers better. It was worth a try...<g> Cheers, Nathan ------------------------------------------------------------ Why is $REMOTE_HOST returning an empty string? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/499 ------------------------------------------------------------ [email protected] You're not doing anything wrong - hostname lookups are turned off by default in many web hosting setups - that DNS lookup can slow your site down by 20% or more. Try doing a gethostbyaddr() call on the contents of $REMOTE_ADDR; http://us.php.net/manual/html/function.gethostbyaddr.html ------------------------------------------------------------ Can I execute multiple database queries in parallel from the same PHP script? Can I do simultaneous database requests in PHP in the same script? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/500 ------------------------------------------------------------ Rasmus Lerdorf Each PHP script has only one thread to execute in. That means that the script must be executed in order. You cannot just perform two database queries simultaneously from a script. You must execute the first, wait for it to finish, and then execute the second query. ------------------------------------------------------------ Why does sort() return things not sorted? Why are my numbers from a database sorted in alphabetical order not numerical? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/503 ------------------------------------------------------------ Nathan Wallace, Tom Henry PHP treats the values from a database as strings by default. That means that if you get numbers out, they will be treated as strings that just happen to contain digits and they will be sorted in alphabetical order. You can try changing them to numbers in a loop over your array using: $a[$i] = intval($a[$i]); http://www.php.net/manual/function.intval.php3 You could also use PHP's settype directive to force the "type" for all processing on a page for that varname Of course, for complex projects you can place all the settype directives into a autoprepend file -- because I'll forever be forgetting about the retyping that's needed on numerics from the database queries. Here's the DOCs on that http://www.php.net/manual/function.settype.php3