我得到这个 错误号:1096 未使用任何表 SELECT * ,我的代码在下面没有得到其中的错误
public function product_approve($id) {
$this->db->select('*');
$this->db->from('approve_products');
$this->db->where('id',$id);
$query= $this->db->get();
if ( $this->db->get()->num_rows() > 0 )
{
foreach ($query->result() as $row) {
$this->db->insert('sub3_category',$row);
}
// $this->db->insert('sub3_category',$query);
if($this->db->affected_rows() >= 0){
$this->db->where('id', $id);
$this->db->delete('approve_products');
}
}
}
更改代码的以下行
if ( $this->db->get()->num_rows() > 0 )
跟
if ( $query->num_rows() > 0 )
希望这有帮助。
更改
$query= $this->db->get();
if ( $this->db->get()->num_rows() > 0 )
到
$query= $this->db->get('approve_products');
if( $query->num_rows() > 0 )
并删除/评论以下行。
$this->db->from('approve_products');
裁判
您也可以使用$this->db->from('approve_products')
,但不能使用$this->db->from('approve_products')
,同时$this->db->get('approve_products')
两者。
private function _get_datatables_queryarc($id,$table)
{
if ($id==1){
$this->db->select('`id`,`name`,`gov`,`proince`');
$this->db->from($table);
}