Re: Simple question on auto_increment
Re: Simple question on auto_increment
am 13.11.2006 22:16:33 von Brad Bonkoski
mario wrote:
> Hello,
>
> really a mysql question. Pls. help anyway.
>
> Is there a simple, common way to implemt the following:
> Say I have a table with a id autoincrement field.
> I wish to insert a record but just ist id value, get back the id value,
> use it to update the record.
>
> Do I need three separate mysql queries? Is there some trick I may use?
> Thanks Regards mario
>
>
www.php.net/mysql_insert_id --or-- www.php.net/mysqli_insert_id
(of course for your example to work all the other fields would have to
be nullable)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Simple question on auto_increment
am 13.11.2006 23:12:02 von Mario
Hello,
really a mysql question. Pls. help anyway.
Is there a simple, common way to implemt the following:
Say I have a table with a id autoincrement field.
I wish to insert a record but just ist id value, get back the id value,
use it to update the record.
Do I need three separate mysql queries? Is there some trick I may use?
Thanks Regards mario
--
mario
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Simple question on auto_increment
am 13.11.2006 23:31:36 von Mario
WOW! perfect, thanks a lot
mario
On Mon, 2006-11-13 at 16:16 -0500, Brad Bonkoski wrote:
> mario wrote:
> > Hello,
> >
> > really a mysql question. Pls. help anyway.
> >
> > Is there a simple, common way to implemt the following:
> > Say I have a table with a id autoincrement field.
> > I wish to insert a record but just ist id value, get back the id value,
> > use it to update the record.
> >
> > Do I need three separate mysql queries? Is there some trick I may use?
> > Thanks Regards mario
> >
> >
> www.php.net/mysql_insert_id --or-- www.php.net/mysqli_insert_id
>
> (of course for your example to work all the other fields would have to
> be nullable)
>
--
mario
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Simple question on auto_increment
am 14.11.2006 11:23:27 von Christian Flothmann
> www.php.net/mysql_insert_id --or-- www.php.net/mysqli_insert_id
>
> (of course for your example to work all the other fields would have to
> be nullable)
>
Or even the MySQL function LAST_INSERT_ID():
http://dev.mysql.com/doc/refman/5.0/en/information-functions .html#id2725312
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php