The WHERE clause or MySQL WHERE condition is used to filter the results from a SELECT data, INSERT data, UPDATE data and DELETE data.
here you want to set where clause for get data from database in Codeigniter and data select from database with descending order.So first pass a unique value in the model page through Controller go to the model page where you write your query for select. The code is write below and I think it’s help for you
Controller:
public function get_table_data(){ $id=$this->input->post('u_id'); $this->MyModel->GetTabledata($id); }
Model:
public function GetTabledata($id){ $qry=$this->db->select('*')->from('Table Name')->where('id',$id)->order_by('id','desc')->get()->result(); return $qry; }
Question and answer is powered by AnsPress.io