Hi,

Friday, November 1, 2002, 11:11:52 PM, you wrote:
SJ> Sorry to keep on at you guys but this is really getting to me now!

SJ> I want to pull a shipping quantity (the very last record in the Db) into
SJ> a page and am still having problems. Tried looping through the records
SJ> and I can't seem to get it to return anything:

SJ> function get_shipping($shippingvar)
SJ> {
SJ> $conn = db_connect();
SJ> $query = mysql_query("SELECT MAX(receipt_id) from receipts");
SJ> $myrow = mysql_fetch_row($query);
SJ> $shippingvar = $myrow["shipping"];
SJ> return $shippingvar;

SJ> }

SJ> Surely it can't be much more complicated than that? 
SJ> Help please. Smoked 10 fags already!
You need something like this (untested :)

function get_shipping($shippingvar){
 $shippingvar = 0;
 $conn = db_connect();
 if(!$query = mysql_query("SELECT MAX(receipt_id) from receipts");){
    echo 'Error: '.mysql_error().'<br>';
 }else{
    $shippingvar = mysql_result($query,0,0);
 }
 return $shippingvar;
}



-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to