Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    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

  • #2
    God Emperor Fou-Lu's Avatar
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts