ID: 45237 User updated by: phpbugs at phormix dot com Reported By: phpbugs at phormix dot com Status: Bogus Bug Type: MySQL related Operating System: FreeBSD PHP Version: 5.2.6 New Comment:
FYI, Same query, when executed through the mysql console, returns a value for fields "userid" and "userid2" Previous Comments: ------------------------------------------------------------------------ [2008-06-11 16:44:46] phpbugs at phormix dot com Just to clarify this, if it were caused by a bad join, would it not also mean that array[0] should be NULL, as well as the aliased array[userid2]? ------------------------------------------------------------------------ [2008-06-11 16:39:38] phpbugs at phormix dot com OK, this seems like odd behavior to me then, and not a JOIN-related issue because of the following: a) The value in question is part of the primary selected table (user) and not one of the joined fields b) Other values in this table are returning properly c) The second variable, userid2, is the SAME field, but just aliased to a new name using "user.userid as userid2" d) The values return fine when using a numeric array, it is only through the name of the associative array that it doesn't work So perhaps I'm being dumb. This isn't my query (it's part of a bulletin-board system), but I can't find any reasons, given the above, that it should be returning results in this manner, and I've been working with PHP+MySQL for quite awhile. ------------------------------------------------------------------------ [2008-06-11 13:41:09] [EMAIL PROTECTED] var_dump, not vardump, sorry for that ------------------------------------------------------------------------ [2008-06-11 13:40:28] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php you're using left joins, therefore you get NULL values. Use vardump() instead of print_r() to get the the information. ------------------------------------------------------------------------ [2008-06-11 13:34:58] phpbugs at phormix dot com Please note that the "expected" result should actually be: Array ( [0] => 22768 [userid] => 22768 [1] => 22768 [userid2] => 22768 [2] => 10 [reputation] => 10 [3] => jdoe [username] => jdoe [4] ... etc ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/45237 -- Edit this bug report at http://bugs.php.net/?id=45237&edit=1
