Error Number: 1096
No tables used SELECT *
$where = array();
if($category){
$where[] = 'subcategories.categories_id = '.$category;
}
if($value){
$where[] = "subcategories.name LIKE '%".$value."%'";
}
$where = implode('and', $where);
$this->db->query("select subcategories.*, categories.name as catname FROM subcategories JOIN categories ON categories.id = subcategories.categories_id where ".$where);
$query = $this->db->get();
I am joining two table category and subcategory with dynamic where condition.same query working in phpmyadmin but getting error in codeigniter , thanks in advance