[eluser]Ivar89[/eluser]
hi,
I recently started using codeIgniter and I am lost atm.
I need to update the last row in my database, this is my code so far in model:
Code:
$sql = $this->db->query ('Select * From tblpage Where ID_Page = (Select Max(ID_Page) From tblpage)');
$id['ID_Page'] = $sql;
if(isset($data['strPageUrl']))
$this->db->set('strPageUrl',$data['strPageUrl']);
if(isset($data['strTitle']))
$this->db->set('strTitle',$data['strTitle']);
if(isset($data['strPageName']))
$this->db->set('strPageName',($data['strPageName']));
$this->db->where('ID_Page',$id);
$query = $this->db->update('tblpage');
return $this->db->affected_rows();
this is my controler:
Code:
{
$this->insert_model->Insert_Description($_POST);
$this->load->view('page/step3');
}
Now if I delete; $this->db->where('ID_Page',$id); it updates all the table.
If it stays there I get a database error:
how can I tell him to just update the LAST row?
thanks,