note 58573 added to function.mysql-fetch-assoc

From: Date: Tue, 08 Nov 2005 15:25:34 +0000
Subject: note 58573 added to function.mysql-fetch-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-98259@lists.php.net to get a copy of this message
Try to use mysql_fetch_assoc to get two fields with the same name from different tables. Example: SELECT sell.prices, buy.prices FROM sell LEFT JOIN buy ON sell.id=buy.id You will get a one-item array contains: 'prices'=>a_value The only way that I know to fix this problem is to change the query in this way: SELECT sell.prices as 'sell.prices', buy.prices as 'buy.prices' FROM sell LEFT JOIN buy ON sell.id=buy.id Did someone know a better way to solve this? ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-assoc.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58573 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58573&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58573&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58573&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58573&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58573&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58573&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58573&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58573&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98259) next »