我有这个,但它不起作用:
$query = "ALTER TABLE `".$table_prefix."posts_to_bookmark`
ADD `ping_status` INT( 1 ) NOT NULL BEFORE `onlywire_status`";
我很感激!
答案 0 :(得分:147)
$query = "ALTER TABLE `" . $table_prefix . "posts_to_bookmark`
ADD COLUMN `ping_status` INT(1) NOT NULL
AFTER `<TABLE COLUMN BEFORE THIS COLUMN>`";
我认为您需要ADD COLUMN
并使用AFTER
,而不是BEFORE
。
如果您想将列放在表的开头,请使用FIRST
语句:
$query = "ALTER TABLE `" . $table_prefix . "posts_to_bookmark`
ADD COLUMN `ping_status` INT(1) NOT NULL
FIRST";