Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Insert Error - Foreign key
03-11-2013, 08:12 PM #1
- Join Date
- Mar 2013
- Thanked 0 Times in 0 Posts
Insert Error - Foreign key
0 0 0 0 0 0
Last edited by idewar; 03-11-2013 at 09:46 PM. Reason: Had to remove included sensitive data
03-11-2013, 09:21 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
Yep, you guess correct.
Insert into the customer, capture the id used by issuing a mysql_insert_id(), do the same with the computer (make sure you issue a query call though as neither of these two currently do). Then take each of those, and use them as the necessary values in the contract during the insertion.
Also, mysql library is nearing EOL; you should consider using mysqli or PDO for your mysql work. Since the current code you have is susceptible to sql injection, you should look at using prepared statements for the mysqli or pdo library and go from there.
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');