Fix columnExists query
This commit is contained in:
parent
ab100ac5ce
commit
848572a709
1 changed files with 4 additions and 2 deletions
|
@ -74,12 +74,14 @@ class Database
|
||||||
|
|
||||||
public function columnExists(string $table_to_check, string $column_to_check): bool
|
public function columnExists(string $table_to_check, string $column_to_check): bool
|
||||||
{
|
{
|
||||||
$result = $this->query(
|
$result = $this
|
||||||
|
->query(
|
||||||
'SELECT *
|
'SELECT *
|
||||||
FROM `INFORMATION_SCHEMA`.`COLUMNS`
|
FROM `INFORMATION_SCHEMA`.`COLUMNS`
|
||||||
WHERE TABLE_NAME = "' . $table_to_check . '"
|
WHERE TABLE_NAME = "' . $table_to_check . '"
|
||||||
AND COLUMN_NAME = "' . $column_to_check . '"'
|
AND COLUMN_NAME = "' . $column_to_check . '"'
|
||||||
);
|
)
|
||||||
|
->fetch();
|
||||||
$exists = false !== $result;
|
$exists = false !== $result;
|
||||||
|
|
||||||
return $exists;
|
return $exists;
|
||||||
|
|
Loading…
Reference in a new issue