You are here: Re: insert in 2 tables & get value from 1st in 2nd « PHP SQL « IT news, forums, messages
Re: insert in 2 tables & get value from 1st in 2nd

Posted by Vincent THOREL on 10/13/73 11:17

Ashok wrote:
> Hi,
> I want to insert values in 2 tables from a form, but in the second table, I
> want to get the (new) id (auto_incr) of the first table in one of the column
> in 2nd table.
> Is it at all possible and how to do this if possible?
>
> Thanks.
> Ashok.
>
>

BEGIN TRANSACTION;
INSERT INTO table1 VALUES (...);
INSERT INTO5 table2 VALUES (LAST_INSERT_ID(), ...);
COMMIT;

 

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

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