insert related fields

Discussion in 'PHP' started by sensoryaddict, Nov 9, 2010.

  1. #1
    Hi,

    Quick simple question

    I am try to insert my form fields into 2 related tables.

    Currently I am using this query:

    $query = "INSERT INTO contacts (id, last_name, first_name, phone_mobile, assigned_user_id) VALUES ('{$id}', '{$lastname}', '{$firstname}', '{$telephone}', '{$user}')";

    The problem is I also want to insert fields $social ; $address, etc

    These fields are located in a separate table "contacts_cstm"

    The common related key is "id"

    How do I correctly construct the query?

    THanks in advance.
     
    sensoryaddict, Nov 9, 2010 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    change the table with phpmyadmin.

    and add the new cell names in the ('names','names1') part and {$social} and {$address} at the other places!
     
    EricBruggema, Nov 13, 2010 IP