I am trying to drop a table with php. I have been working with php for a couple of months now, and don't see why I am getting an error. Sample Code:
include 'SQLaccount.php';
$sql = "DROP TABLE RequestBooks;";
if (!$accountCon->query("SET a=1")) {
printf("Errormessage: %s\n <br> SQL: %s", $accountCon->error , $sql);
}
$accountCon->close();
And this is the error:
Errormessage: Unknown system variable 'a' //What I get when I run theabove code
SQL: DROP TABLE RequestBooks;
I can drop the table from PHPMyAdmin, and the user I am using has all permissions granted. I use this same query setup for all of my mysql needs, with no problem.
Edit 1:
I was running a query on SET a=1 and not $sql.
include 'SQLaccount.php';
$sql = "DROP TABLE RequestBooks;";
if (!$accountCon->query(**$sql**)) {
printf("Errormessage: %s\n <br> SQL: %s", $accountCon->error , $sql);
}
$accountCon->close();
Thanks for your help.
if (!$accountCon->query("SET a=1"))beif (!$accountCon->query($sql))??ais undeclared, perchance?ais related here.