Posted by Kim Andrι Akerψ on 10/02/05 13:27
Vic Spainhower wrote:
> Thanks Gordon,
>
> The following code seems to work fine ....
>
> $query = "SELECT LAST_INSERT_ID()";
> $result = mysql_query($query);
> if ($result) {
> $nrows = mysql_num_rows($result);
> $row = mysql_fetch_row($result);
> $lastID = $row[0];
> $_SESSION["entryID"] = $lastID;
> }
Please note that the PHP function mysql_insert_id() will return the
same as you're trying to fetch.
$lastID = mysql_insert_id();
http://php.net/mysql_insert_id
--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
[Back to original message]
|