|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-08-06 23:32 UTC] quixote at toysmakeuspowerful dot com
Description: ------------ select a.*,b.* from a join b on a.id=b.id; mysql_fetch_assoc() returns null for id. select a.*,b.*,a.id from a join b on a.id=b.id; Works, since last instance overrides previous as per documentation. However it should be in the first case that b.id would get returned automatically, since it is the second instance. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 16:00:01 2025 UTC |
Hi, please give a complete example including table definitions, table data and the MySQL version used. Works fine for me with 5.2.6 and 5.3 @ Linux @ MySQL 5.0.51b: nixnutz@ulflinux:~/php-5.2.6> sapi/cli/php -r '$m = mysql_connect("127.0.0.1", "root", "root"); var_dump($m); mysql_query("USE test", $m); $r = mysql_query("select a.*, b.* from a, b where a.id=b.id", $m); while ($row = mysql_fetch_assoc($r)) var_dump($row);' resource(4) of type (mysql link) array(1) { ["id"]=> string(1) "1" } array(1) { ["id"]=> string(1) "2" } array(1) { ["id"]=> string(1) "3" } create table a(id int); insert into a(id) values(1), (2), (3); create table b(id int); insert into b(id) values(1), (2), (3); Adding a column after a.id does not change my results. Ulf