Posted by Steve on 09/19/05 00:58
> $query = "select max(qno) from answers";
> $result = mysql_query($query);
> $maxqno = mysql_result($result);
> $nextqno = $result + 1;
mysql_result() needs a minimum of two arguments: resource and row
number.
Alternatively, use an alias for the aggregate column and get it by
name:
$query = "select max(qno) as maxqno from answers";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result, MYSQL_ASSOC );
print $row[ 'maxqno' ];
---
Steve
[Back to original message]
|