Well thats pretty much it.
This is my query:
$query = 'ALTER TABLE permissions ADD '.$name.' INT NOT NULL DEFAULT \'0\'';
Where $name is already checked to exist with only lower case alpha letters, and not more than 20 length. Im just starting this out with very simple names.
The next 4 lines of code after that one are:
if($stmt = $db -> prepare($query))
{
$success = $stmt -> execute();
$stmt -> close();
if(!$success)
echo 'ERROR: Unsuccessful query: ',$db->error,PHP_EOL;
}
And I get back, every time
ERROR: Unsuccessful query:
And no error message. Is there a way to get more error messages so I can see what is failing? I can add new columns through phpmyadmin, but that really doesnt help me at all.
The $db is fine, i do lots of stuff before and after this one section. It is only adding new column to the table that fails.
- side question: prepare() rejected my query every time when i tried to make those 2 variables, the $name and the 0 value as ? ? prepared statement values. Thats why they are in the real query and not bound later. If i could change that too I would like that.