database queries with join
| From: | Harold | Date: | Tue, 23 Nov 1999 18:35:25 +0000 |
| Subject: | database queries with join | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6751@lists.php.net to get a copy of this message | ||
(php4 beta3 / apache 1.3.9 / redhat 6.0 / sybase 11.9.2)
although i have not yet run into problems with database queries on more than
1 table, i noticed an odd behaviour of php.. here is an example query:
$query = sybase_query("select FIELD1.row1, FIELD1.row2 from FIELD1, FIELD2
where FIELD2.row3 = FIELD1.row3");
$row = sybase_fetch_array($query);
echo $row[row1];
echo $row[row2];
----
there is no problems with the above, but since im using a join, wouldnt it
be better to use:
echo $row[FIELD1.row1];
echo $row[FIELD1.row2];
when the above is used, php returns a null. i havent come across a JOIN
where the field names are the same in two or more tables, but when it would
occur, which (field)value would echo $row[row1]; be taken from?