Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord and Sessions issues?

Hi all,

Got a couple annoying problems and hoping someone might know the answers!

1) Using an ActiveRecord in certain situations will either return all the records, or return nothing at all. I can literally hit Refresh a few times and watch as sometimes the query returns the correct results and others it does not.

$query = $this->db->get($tablename);
$ret = $query->result_array();
return $ret;

There are no errors displayed with debug on when the results are not displayed. Any ideas?

2) I'm using session variables to save the page to re-direct to after another form is submitted. I'm using basic code such as:

$this->session->set_userdata('redirect', 'opportunities/edit/1');

Right after this is set, I can echo $this->session->userdata('redirect') and get the expected result. When I attempt to retrieve the value on the next page, (ie. echo $this->session->userdata('redirect')) it returns 'opportunities/edit/' (the 1 is dropped). Even if I put a / on the end - ie. opportunities/edit/1/, it returns opportunities/edit//.

Why is the digit one being dropped?

Thanks for any and all help you can provide.


[eluser]Noah David[/eluser]
1. Try something like this...

$this->db->select('a, b')->from('d')->where('x', $x);
$query = $this->db->get();
foreach ($query->result() as $row)
    echo $row->a;
What do you get?

2. No idea. What happens when you replace the 1 with something else, like 'one'? opp/edit/one

Theme © iAndrew 2016 - Forum software by © MyBB