note 30283 added to function.ocifetchstatement
| From: | adelac05 at sprintspectrum dot com | Date: | Wed, 12 Mar 2003 22:40:59 +0000 |
| Subject: | note 30283 added to function.ocifetchstatement | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45180@lists.php.net to get a copy of this message | ||
One thing I found with this:
If you have two tables with the same column names, you will run into problems when displaying them,
i.e:
$sql = "select a.name, b.name, c.phone
from table1 a, table2 b, table3 c";
php will overwrite the a.name display cell with the b.name value. So you wanted three cells to
display and you are only getting two. i.e.
What you wanted:
----------------------------------------
| Bob | Jones | 555-555-5555 |
----------------------------------------
What you got:
-----------------------------------------
| Jones | 555-555-5555 | |
-----------------------------------------
Resolution: rename your table column names as they come in.
$sql = "select a.name, b.name AS NAME2, c.phone
from table1 a, table2 b, table3 c";
--
http://www.php.net/manual/en/function.ocifetchstatement.php
http://master.php.net/manage/user-notes.php?action=edit+30283
http://master.php.net/manage/user-notes.php?action=delete+30283
http://master.php.net/manage/user-notes.php?action=reject+30283