Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Insert Error - Foreign key

    0 0 0 0 0 0
    Last edited by idewar; 03-11-2013 at 08:46 PM. Reason: Had to remove included sensitive data

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 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'); 


  •  

    Posting Permissions

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