Welcome Guest, Not a member yet? Register   Sign In
Session->set_flashdata Doesn't Work After Database Query
#3

[eluser]Nalorin[/eluser]
Ok - I found the solution. It had to do with overlapping Active Record calls.

See, I had a bunch of items in my database, and was deleting them while I was testing this form... and I was running out of things to delete (so I worked in favour of "pretending" to delete ads, rather than having to repopulate the database)... My code in my Ad_model looked like this:

Code:
function delete_record($table,$id)
  {
    if ( ! in_array($table,array('tbl1','tbl2','tbl3'))) return 0;

    $login_data = $this->session->userdata('login_data');

    // The following 2 lines were the problem - I was setting an active record "where" clause
    // but never using it, so it poisoned the session model's active record query.
    $this->db->where('user_id',$login_data['id']);
    return TRUE; // inserted for debugging
    // when I flipped the above two statements around, it fixed the problem, since the where
    // clause was not getting executed anymore

    return $this->db->delete($table,array('id'=>$id));
  }


Messages In This Thread
Session->set_flashdata Doesn't Work After Database Query - by El Forum - 09-07-2010, 11:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB