Results 1 to 2 of 2

Thread: Insert

  1. #1
    Join Date
    Feb 2004
    Location
    Ninth Hell
    Posts
    19

    Unanswered: Insert

    What is the correct PHP syntax to run this sql query:

    INSERT INTO table1
    SELECT * FROM table2;

    thanks, death2all.

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: Insert

    Originally posted by death2all
    What is the correct PHP syntax to run this sql query:

    INSERT INTO table1
    SELECT * FROM table2;

    thanks, death2all.
    For example for mysql:

    $stmt = mysql_query("INSERT INTO table1SELECT * FROM table2");
    if(!$stmt){
    die("Error in executing of statement");
    } else {
    echo "Query executeted successfully";
    }

    If your database is transactional don't forget to COMMIT

Posting Permissions

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