Date: 11/27/01
- Next message: Andrew Hill: "RE: [PHP-DB] problems in connecting Access database"
- Previous message: matt stewart: "RE: [PHP-DB] get the record id of the last addition in a table"
- In reply to: matt stewart: "RE: [PHP-DB] get the record id of the last addition in a table"
- Next in thread: Mad Nas: "[PHP-DB] Re: get the record id of the last addition in a table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <matt <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:JLeTortorec <email protected>]
> Sent: 26 November 2001 22:22
> To: 'php-db <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: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
---- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andrew Hill: "RE: [PHP-DB] problems in connecting Access database"
- Previous message: matt stewart: "RE: [PHP-DB] get the record id of the last addition in a table"
- In reply to: matt stewart: "RE: [PHP-DB] get the record id of the last addition in a table"
- Next in thread: Mad Nas: "[PHP-DB] Re: get the record id of the last addition in a table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

