Welcome Guest, Not a member yet? Register   Sign In
problem with active record
#1

[eluser]Unknown[/eluser]
I'm using active records in all retrieve data from database, but some queries I do with active record has troubles, generally don't bring the last record...

for example

I have 5 records in my database with this idCategory

I have this query by active record

$this->db->where('idCategory','1');
$this->db->where('status','1');
$this->db->order_by('dateHour','desc');
$query = $this->db->get('news',10,$offset);
$data['news'] = $query->result();

That should generate this sql below

SELECT * FROM news WHERE idCategory = 1 and status = 1 order by dateHour desc

BUT, when a call the controller that has this query(active record), it bring to me only 4 records(don't bring me the last)

AND when I execute the sql normal in the database, bring me exactly what I want, the 5 records




Theme © iAndrew 2016 - Forum software by © MyBB