Re: manual key generation
| From: | R'twick Niceorgaw | Date: | Sat, 25 Oct 2003 22:55:36 +0000 |
| Subject: | Re: manual key generation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167587@lists.php.net to get a copy of this message | ||
Joao Andrade wrote:
Aloha! I have a script that inserts a new row in a table called "quotations", which has a primary key called "quotation_id". "quotation_id" is an int(11) type. 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 What the hell is that supposed to mean? Thanx a bunch. mysql_query returns a resource id. you have to use mysql_fetch_row or mysql_fetch_array to get the data from this resurce idsomething like $sql_result = mysql_query("SELECT MAX(quotation_id)+1 from quotations"); $new_key = mysql_fetch_row($sql_result); HTH R'twick