#21589 [Bgs]: mysql_fetch_assoc() and duplicate field names

From: Date: Sat, 11 Jan 2003 22:41:14 +0000
Subject: #21589 [Bgs]: mysql_fetch_assoc() and duplicate field names
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29795@lists.php.net to get a copy of this message
ID: 21589 Updated by: pollita@php.net Reported By: rabidvan@mail.ru Status: Bogus Bug Type: MySQL related Operating System: Windows XP and 2000 PHP Version: 4.2.3 New Comment: That is not a function of the mysql client libraries, MysqlFront does some automagic renaming of the fields. When doing queries which return ambiguous identically named fields consider using the "as" opperator in your SQL statement. For more information see the mysql documention at: http://www.mysql.com/ Previous Comments: ------------------------------------------------------------------------ [2003-01-11 16:24:53] georg@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. ------------------------------------------------------------------------ [2003-01-11 16:18:32] rabidvan@mail.ru I have 2 tables: [table1] BLOCK_ID mediumint(8) SUB_ID mediumint(8) ... [table2] BLOCK_ID mediumint(8) ... I call query: SELECT * FROM table1 a, table2 b WHERE a.sub_id=b.block_id AND a.block_id=1; It works well. But when I use same query without aliases: SELECT * FROM table1, table2 WHERE table1.sub_id=table2.block_id AND a.block_id=1; In this case mysql_fetch_assoc() returns only 1 field BLOCK_ID and it's table2.BLOCK_ID. I think it's a bug in mysql_fetch_assoc() because MysqlFront returns table1.BLOCK_ID as BLOCK_ID and table2.BLOCK_ID as BLOCK_ID_1 Thank you. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21589&edit=1

« previous php.bugs (#29795) next »