我遇到了一個簡單的查詢返回表中的行數的奇怪問題。奇怪的數據庫問題! PHP MySQL Codeigniter
這總是工作正常。
但是!昨天我在我的網站上添加了一個新功能,用於更新表格中現有行的列。該功能稱爲add_file()
現在我的網站是給它應該是什麼錯誤值:
目前,在我所謂的phpMyAdmin的和SQLyog的觀察「程序」錶行。
但是在我的網站上有說有。
機是不會說謊的,所以這是最有可能我做
我有一種預感,我的函數調用add_file()是難辭其咎的。
如果用戶上傳與該記錄相對應的文件,該功能的作用是更新我的過程表中的「edocument」列。以便系統知道該文件被調用並可以爲其構建一個url。
public function add_filename($file)
{
//This is the extension of the file retrieved from an array
$extension = $file['upload_data']['file_ext'];
//variable for updating row which is constructed from Username+Filename+Extension
$filename = array
(
'edocument' => ($this->session->userdata('name').$this->input->post('record_id')).$extension
);
//find row that matches the row just submitted by user
$this->db->where('procedure_id',$this->input->post('record_id'));
//update that row with the filename of the document uploaded
$this->db->update('procedure', $filename);
}
如果你看看這個截圖,你會看到我的72-76的「edocument」列有值。
原來是更新功能打破我的數據庫?
謝謝
+1在代碼中有很好的評論。這就是評論應該是這樣的! – Pindatjuh
謝謝! :)評論對我很重要,否則我忘記我的代碼後來 – sqlmole
「在我的網站上它說有70」 - 什麼是使用的SELECT查詢給你70個結果? UPDATE本身不應該與它有任何關係。 *是*你的問題是什麼,對嗎?你在問爲什麼它只顯示70條記錄? –