hi guys I am trying to run multiple queries thru mySQL and php and have not so far been able to figure it out... I read that mysqli_multi_query might be what I want and tried it as well with only the first query being run because I had them in this format. "query";"query";"query" etc...so my last attempt was like this "query;query;query" etc and nothing happens can someone please figure out the syntax to get all 4 queries to run consecutively. here is the queries first then the php code.
INSERT INTO queue (SELECT NULL,item1, log, Active FROM shipping WHERE Active = 1);
DELETE FROM shipping ORDER BY id ASC LIMIT 1;
UPDATE shipping SET Active ='0' ORDER BY id DESC LIMIT 1;
UPDATE shipping SET Active ='1' ORDER BY id ASC LIMIT 1;
and here is the php..
<?php
$servername = "localhost";
$database = "logistics";
$username = "root";
$password = "";
$conn = mysqli_connect($servername, $username, $password, $database);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO queue (SELECT NULL,item1, log, Active FROM shipping WHERE Active = 1);
DELETE FROM shipping ORDER BY id ASC LIMIT 1;
UPDATE shipping SET Active ='0' ORDER BY id DESC LIMIT 1;
UPDATE shipping SET Active ='1' ORDER BY id ASC LIMIT 1"
if (mysqli_multi_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
?>
Thanx in advance.