Below is the query I'm executing through the code below
$stmt2 = $conn->prepare(
"USE $database;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
/*Table structure for table `scans` */
CREATE TABLE IF NOT EXISTS `scans` (
`id` int(11) NOT NULL auto_increment,
`uid` varchar(35) NOT NULL,
`date_time_stamp` datetime NOT NULL,
PRIMARY KEY (`id`))"
);
$stmt2->execute();
$result2 = $stmt2->get_result();
I have no problem executing the above query directly in phpmyadmin but when executing with php code, it throws the error.
The error upon executing the above query with the code above was this(below):
The error was: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
Can any one help me spot the syntax error? BTW it's a problem I ran through executing the above mysql query while trying to create tables on MariaDB Ver 15.1 Distrib 10.4.24-MariaDB,
Tried executing the query with php