1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''dataInjections' LIKE 'type'' at line 1 in /.../.../.../restapi.php:174
private function CheckUpdates()
{
if(!$this->columnExists('dataInjections','type'))
{
$connection = self::Connection();
$statement = $connection->prepare("ALTER TABLE `dataInjections` ADD `type` INT(0) NOT NULL AFTER `icon`");
$count = $statement->execute();
}
}
private function columnExists($tblName, $clmnName)
{
$connection = self::Connection();
$statement = $connection->prepare("SHOW COLUMNS FROM ? LIKE ?");
$count = $statement->execute([$tblName, $clmnName]);
if ( $count != 0 )
return true;
return false;
}
private function tableExists($tblName)
{
$connection = self::Connection();
$statement = $connection->prepare("SELECT COUNT(*) as cnt from INFORMATION_SCHEMA.TABLES where table_name = ?");
$statement->execute([$tblName]);
$tableCount = $statement->fetchColumn();
if ( $tableCount != 0 )
return true;
return false;
}