mysql_fetch_row does not return an associative array, only enumerated.
http://www.php.net/manual/en/function.mysql-fetch-row.php
Try mysql_fetch_array instead.

-----Original Message-----
From: Tom Rogers [mailto:trogers@;kwikin.com]
Sent: Friday, November 01, 2002 7:53 PM
To: Steve Jackson
Cc: MySQL General Mailing list; PHP General
Subject: Re: [PHP] Get shipping problem continued!


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


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to