You are here: Re: [PHP-DB] auto_increment and INSERT INTO « PHP « IT news, forums, messages
Re: [PHP-DB] auto_increment and INSERT INTO

Posted by "Ron Piggott (PHP)" on 01/22/06 07:28

That is the function I was looking for. Thanks. Ron

On Sat, 2006-01-21 at 23:47 -0500, tg-php@gryffyndevelopment.com wrote:
> Try:
>
> <?php
> mysql_query("INSERT INTO table VALUES ('$variable_1', '$variable_2');");
> $auto_increment_variable = mysql_insert_id();
> ?>
>
>
> -TG
>
>
>
>
> = = = Original message = = =
>
> I have various tables where a column is set to auto_increment in my
> table structure. I have been using the following INSERT query format:
>
> INSERT INTO table VALUES ('$auto_increment_variable','$variable_1',
> '$variable_2')
>
> and then in applications where I have needed to know the value of the
> $auto_increment_variable I have immediately queried the table for
> $variable_1 and $variable_2 and used
>
> $reference = mysql_result($result,$i,"reference");
>
> to determine what numeric value was assigned.
>
> Is there a way I may find out what value was assigned to the
> $auto_increment_variable when the INSERT INTO query is issued?
>
> Thanks.
>
> Ron
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация