使用我收到以下錯誤:MySQL服務器版本正確的語法近
"Error: 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 ' `DeweyEdition`
BLOB NOT NULL, , `DeweyNumber` BLOB NOT NULL)' at line 1
<br />Error No: 1064<br />ALTER TABLE tt_hj_import ADD COLUMN
(`CountryOfPub` BLOB NOT NULL, , `DeweyEdition` BLOB NOT NULL, ,
`DeweyNumber` BLOB NOT NULL) in /var/www/system/database/mysql.php on line 50"
我的代碼:
public function alterImportTable($new_fields) {
if (!empty($new_fields)) {
$sql = "ALTER TABLE " . DB_PREFIX . "hj_import ADD COLUMN ";
$fields_sql = array();
foreach ($new_fields as $field) {
$fields_sql[] = '`' . $field . "` BLOB NOT NULL, ";
}
$sql .= '(' . implode(', ', $fields_sql) . ')';
$sql = str_replace(',)', ')', $sql);
$this->db->query($sql);
}
}
我該如何解決這個問題?
爲了緩解幫助您可以在粘貼之前,SQL的'' - >查詢「電話? – nrathaus