#20078 [Bgs]: Error with left join with mysql_fetch_array()

From: Date: Fri, 25 Oct 2002 09:49:08 +0000
Subject: #20078 [Bgs]: Error with left join with mysql_fetch_array()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-23291@lists.php.net to get a copy of this message
ID: 20078 Updated by: hholzgra@php.net Reported By: f.giovannini@netechnologies.it Status: Bogus Bug Type: MySQL related Operating System: Linux 2.4.18 PHP Version: 4.2.1 New Comment: that's one of the reasons why you should never use 'select * from ...' -> you haven't specified *which* P column you want, A.P or B.P php gives you B.P as P while the cmd line cliebt chose to display A.P ... Previous Comments: ------------------------------------------------------------------------ [2002-10-25 04:32:17] 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. If you use mysql_fetch_array with MYSQL_FETCH_ASSOC, be sure that fieldnames are unique. Georg ------------------------------------------------------------------------ [2002-10-25 04:23:20] msopacua@php.net What 'not enough information' meens in this case, is the lack of a short, self contained, copy/paste/run script, so we can try to reproduce the problem. ------------------------------------------------------------------------ [2002-10-25 04:15:21] f.giovannini@netechnologies.it This problem is verified with any mysql version.... $array ------------------------------------------------------------------------ [2002-10-25 04:08:12] derick@php.net Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. ------------------------------------------------------------------------ [2002-10-25 04:07:24] f.giovannini@netechnologies.it Using mysql_fetch_array function if submit an query with left join es.: select * from A left join B on (A.index_c=B.index_c) the resulting array contains fields of table B with NULL value if condition is not matched es.: A table: ---------------------------- | index | index_c | X | P | ---------------------------- | 1 | 1 | 1 | 1 | ---------------------------- | 1 | NULL | 1 | 1 | ---------------------------- B table: ------------------- | index_c | P | D | ------------------- | 1 | 1 | 2 | ------------------- Array result: --------------------------------- | index | index_c | X | P | D | --------------------------------- | 1 | 1 | 1 | 1 | 2 | --------------------------------- | 1 | NULL | 1 |NULL|NULL| --------------------------------- with command line mysql: --------------------------------- | index | index_c | X | P | D | --------------------------------- | 1 | 1 | 1 | 1 | 2 | --------------------------------- | 1 | NULL | 1 | 1 | | --------------------------------- bye ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20078&edit=1

« previous php.bugs (#23291) next »