If you don't necessarily want to know what the next id should be and just
want it inserted for the next item added to the database, when you do the
insert statement, use '' as the value for that field.
matt stewart <[EMAIL PROTECTED]> said:
> $last_add = mysql_insert_id();
> - thanks to Bruno Gimenes Pereti who answered this very same question when i
> asked it a couple of weeks ago ;)
>
> all the best,
> Matt
>
>
> -Original Message-
> From: LeTortorec, Jean-Louis [mailto:[EMAIL PROTECTED]]
> Sent: 26 November 2001 22:22
> To: '[EMAIL PROTECTED]'
> Subject: [PHP-DB] get the record id of the last addition in a table
>
>
> Hi:
>
> I've created a table. The fields are "id" (auto-increment, integer),
> "field1","field2),...
>
> When I do "insert into mytable (field1..) values (...)", how to get in
> return the value of "id"?
>
> Thanks
>
>
>
> Jean-Louis
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]