Re: manual key generation
| From: | David Otton | Date: | Sat, 25 Oct 2003 23:02:06 +0000 |
| Subject: | Re: manual key generation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167589@lists.php.net to get a copy of this message | ||
On Sat, 25 Oct 2003 20:31:37 -0200, you wrote:
>When I enter:
>
> SELECT MAX(quotation_id)+1 from quotations
>
> I get simply the number 7 (which is ok)
>
> But when I do:
>
> $new_key = mysql_query("SELECT MAX(quotation_id)+1 from quotations")
>
> I get $new_key = Resource id #3
Long answer: you need to read the manual pages for mysql_query. The function
doesn't return data, it returns a database connection from which you can
recover the data.
Short answer:
$rs = mysql_query("SELECT MAX(quotation_id)+1 from quotations");
$row = mysql_fetch_row ($rs);
print_r ($row);