$DataInsert = [
'id' => $Id,
'name' => $name,
'price' => $Price,
'available' => $Stock,
];
$this->db->table('services')->insert($DataInsert) //This data does not enter the database but the response is TRUE
我知道有一列的資料型別與我輸入的資料不匹配,但是為什么回應true雖然沒有輸入到資料庫中?
uj5u.com熱心網友回復:
嘗試這個。
$DataInsert = array(
'id' => $Id,
'name' => $name,
'price' => $Price,
'available' => $Stock,
);
$this->db->table('services')->insert($DataInsert);
if($this->db->affected_rows() > 0){
//message
}
如果您堅持評估 insert() 方法,請改用此方法。
if($this->db->table('services')->insert($DataInsert) !==FALSE){
//message
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/431250.html
下一篇:動態從資料庫中獲取祖先資料
