Hi Xavier, > Is there any ways to re-use an auto_increment table unique ID in others > record fields, like this : > > INSERT INTO <tablename> SET <field1> = pID, <field2> = "aaa" > > where pID is the ID of the inserted record! > > with this table schema : > ------------------------------------------- > <tablename> > <pID> : primary key, auto_increment, unique > <field1> : varchar > <field2> ; varchar > etc. > ------------------------------------------- > > I've trying to use LAST_INSERT_ID(), or mysql_insert_id()...but it doesn't > work properly...it doesn't provide the right the good way of doing it!
The problem is one of 'philosophy' not SQL commands! People who have problems are usually trying to use AUTO_INCREMENT in ways that weren't intended. In this case you have CREATEd a table and asked MySQL to administer pID, yet in the example INSERT statement you appear to be trying to 'take command' - you're trying to start a wrestling match with the RDBMS! Please post your SQL/PHP code showing how you are currently loading/updating both tables. I'm sure we can get things working for you! Regards, =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php