Re: Only 1 Query Result...help.
| From: | Don Read | Date: | Tue, 16 Oct 2001 20:09:06 +0000 |
| Subject: | Re: Only 1 Query Result...help. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71255@lists.php.net to get a copy of this message | ||
On 16-Oct-2001 Chris Cocuzzo wrote:
> alright. that part is pretty much finished up. I've run into another
> curiosity/problem in writing another part of the photo system. I want to
> find the largest ID in the db so that I can make sure of when the person
> clicking through is at the end of the album
>
> here's my query:
> $query = "SELECT MAX(picid) FROM pics";
> $result = mysql_query($query,$conn);
>
> I'm a little bit unsure of how to pull this data out though(i was thinking
> mysql_fetch_array again). My first thought was: $max_id =
> extract(mysql_fetch_array($result)).
>
> Can anyone help out?
$qry ="SELECT MAX(picid) as maxid FROM pics";
$res =mysql_query($qry);
if ($res) {
$row = mysql_fetch_object($res);
echo $row->maxid, '<br>';
}
Regards,
--
Don Read dread@texas.net
-- It is necessary for me to learn from others' mistakes. I
will not live long enough to make them all by myself.