Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Posts
    4

    Exclamation Unanswered: insert data into more tables

    hi there.......


    now i had coding how to insert data into one table only........
    so, how can i insert data into more tables? i know by detect which one primary and foreign key?

    but how it works?

  2. #2
    Join Date
    Nov 2001
    Posts
    12
    $sql="INSERT INTO TABLE1 " .....
    if (mysql_query($sql,$dbcnx)){
    $sql="INSERT INTO TABLE2 " .....
    if (mysql_query($sql,$dbcnx)){
    else {
    echo ("Error in insert");
    }
    }
    else {
    echo ("Error in insert");
    }

    and if you need to know the autoincrement value for the next insert
    $id=mysql_insert_id();

Posting Permissions

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