php mysql max() question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: Main PLUG discussion list
Subject: php mysql max() question
just want the max of an integer field ultimately into a variable.

<?php
$MaxSalesOrders = 'SELECT MAX(orderno) FROM salesorders;';
mysql_connect("$HOST", "$USER", "$PASSWD");
mysql_select_db("lighting_unlimited");
$MaxSalesOrdersResult = mysql_query($MaxSalesOrders);
mysql_close();
echo var_dump($MaxSalesOrdersResult) . " - " . \
$MaxSalesOrdersResult;
?>

seems pretty straight forward. In mysqlclient, the answer is of course
returned - perhaps as a row, I'm never quite sure.

The code above returns the following in a browser...

resource(6) of type (mysql result) - Resource id #6

and I've been trying all sorts of things 'SELECT AS...' and Googled for
several hours and I'm sort of convinced that what is being returned from
the sql query is neither an array, nor string and has to be converted
into a variable that is useful to me.

Anyone know how to do this (i.e. without pear-db)?

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss