MySQL Forums
Forum List  »  PHP

Re: Insert ID from one table to another?
Posted by: Peter Brawley
Date: December 06, 2013 08:06PM

1. Lose the quotes round NULL.

2. Always ... or exit( mysql_error() ) to catch error messages

3. $id = mysql_insert_id();

4. $sqlstatement ="INSERT INTO Modules VALUES ( $id, '$title', '$modcode', '$hours')";

5. Switch to mysqli API (the mysql API you are using is going away).



Edited 1 time(s). Last edit at 12/07/2013 11:31AM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
Re: Insert ID from one table to another?
December 06, 2013 08:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.