ID:               45737
 Updated by:       [EMAIL PROTECTED]
 Reported By:      quixote at toysmakeuspowerful dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQL related
 Operating System: Windows and Linux
 PHP Version:      5.2.6
 New Comment:

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:

[EMAIL PROTECTED]:~/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



Previous Comments:
------------------------------------------------------------------------

[2008-08-06 23:32:54] 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.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45737&edit=1

Reply via email to