Here is my code:
ALTER TABLE `$table` ADD PRIMARY KEY `id` INT( 11 ) NOT NULL AUTO_INCREMENT FIRST
It keeps giving me errors about the syntax on adding a primary key. What will make it go through?
Also, I am trying to add the new column id
to the table.
Try this syntax:
ALTER TABLE `$table`
ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY(`id`);