pg_fetch_object with multiple tables

wxdqz

New Member
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
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
 
Back
Top