这是我正在使用的声明。
$sql = "INSERT INTO store (shop_id, shop_index, items) VALUES ('$shop_id','65535','4')";
$this->db->query($sql);
return shop_st;
shop_st 是自动递增的主键,我想返回它。我想知道我的查询是否正确。如果我出错了,请告诉我。
最佳答案
试试这个
$data = array(
'shop_st' => NULL,
'shop_id' => $shop_id ,
'shop_index' => '65535' ,
'items' => '4'
);
function insertShop($data)
{
$res=$this->db->insert('store', $data)
if($res)
{
return $res;
}
else
{
return false;
}
}
关于php - 在 codeigniter 中插入语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21598057/