SQL query string
Posted: Thu Aug 18, 2005 11:25 pm
How can I have, for example, multiple INSERT statements in a string and pass that string to
mysql_query?
$sql .= "INSERT INTO table (column1, column2) VALUES ('apple', 'orange')";
$sql .= "INSERT INTO table (column1, column2) VALUES ('red', 'blue')";
mysql_query($sql, $conn);
This is basically what I have but I'm geting an error.
I've also tried:
$sql .= "INSERT INTO table (column1, column2) VALUES ('apple', 'orange');";
mysql_query?
$sql .= "INSERT INTO table (column1, column2) VALUES ('apple', 'orange')";
$sql .= "INSERT INTO table (column1, column2) VALUES ('red', 'blue')";
mysql_query($sql, $conn);
This is basically what I have but I'm geting an error.
I've also tried:
$sql .= "INSERT INTO table (column1, column2) VALUES ('apple', 'orange');";