我敢肯定我錯過了一些明顯的東西,請快看,謝謝。問題可能出現在結構中(下面發佈)。爲什麼這個簡單的MySQL查詢失敗?
public function addNewFile($ext) {
$addNewFileQuery = "INSERT INTO pictures (ext) VALUES (".$ext.")";
$result = mysqli_query($this->connection, $addNewFileQuery) or die('could not execute query in addnewfile, extension: '.$ext.' query: '. $addNewFileQuery);
return(mysqli_insert_id($this->connection));
}
顯示模錯誤信息是: 「不能在addnewfile執行查詢,擴展名:GIF查詢:INSERT INTO圖片(EXT)VALUES(GIF)」
數據庫的結構:
Name Type Collation Attributes Null Default Extra
id bigint(20) No None AUTO_INCREMENT (primary)
ext varchar(6) latin1_swedish_ci No None
title varchar(100) latin1_swedish_ci Yes NULL
caption varchar(200) latin1_swedish_ci Yes NULL
date_uploaded timestamp No CURRENT_TIMESTAMP
謝謝大家權之前......>< – Andrew