pg_fetch_object() not returning values from multi-table query
| From: | K Old | Date: | Mon, 03 Dec 2001 23:01:58 +0000 |
| Subject: | pg_fetch_object() not returning values from multi-table query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14786@lists.php.net to get a copy of this message | ||
Hello all,
I have the following code:
/* construct the query */
$the_sql = "SELECT inv.at_id FROM invoice_items inv, customer cus WHERE inv.client_id = cus.client_id AND inv.inv_id = '2001-12-03-4'";
/* send the statement to query() for processing */
$qid = query($the_sql);
$rows = pg_numrows($qid);
//echo "Number of rows: $rows";
/* each row in the result will be packaged as an
object and put in an array */
$out_string = "";
/* start building the string */
$out_string .= "<tr>";
for($i = 0; $i < $rows; $i++) {
//echo "I: $i\n";
$dbvalue = pg_fetch_object($qid, $i);
/******************* Problem is on the next line **********************/
$id = $dbvalue->at_id;
}
$out_string .= "</td></tr>";
Problem is $id is never set to anything. I have 3 tables linked together and to find the value of inv.at_id and I can't get the pg_fetch_object to return my value. This query works via the command line, so it's not the query. I've tried doing $dbvalue->inv.at_id as well and can't get it to return my value.
Any ideas?
Thanks,
Kevin
kevsurf@hotmail.com
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp