RE: [PHP] Not quite relevant question about coding and query
| From: | Jason Murray | Date: | Fri, 19 Jan 2001 05:56:55 +0000 |
| Subject: | RE: [PHP] Not quite relevant question about coding and query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-35570@lists.php.net to get a copy of this message | ||
> $query = "insert into user values
('firstname','lastname','address','phone')";
> $resultinsert = mysql_query($query);
>
> $getID = "select userID from user"; // Will this get me the
> // Id of the record I just inserted?
> $resultID = mysql_query($getID);
No, it won't - it'll return every userID in the table.
If your userIDs are sequential, you can just select "MAX(userID)" instead
of userID.
Jason