模型:
$query = $this->db->query("SELECT count(*) as c from event where id=48 and Ev_id=352");
if($query == 0){
$act = array(
'ev_id' => $ev_id,
'id' => $id ,
'count' => '1'
);
//print_r($act);
$this->db->insert('join()', $act);
}
else{
echo"Unable to join";
答案 0 :(得分:0)
根据manual:
你应该使用
if ($query->num_rows() > 0)
插入是这样的:
$data = array(
'title' => $title,
'name' => $name,
'date' => $date
);
$this->db->insert('mytable', $data);