Welcome Guest, Not a member yet? Register   Sign In
How can i make model query based on images
#8

PHP Code:
$query $this->db->query("SELECT * FROM `articles` WHERE art_jenis = 'TREND' ORDER BY art_id DESC limit 1,2"); 

I've changed the limit portion of the query here to return 2 items, skipping the first item (if I wanted the first 2 items, I could use "limit 0,2" or "limit 2").

Then, instead of using the row_array() function, you can use result_array():
PHP Code:
$rows $query->result_array();
$data['rows'] = $rows

Personally, I would have my model return $query->result_array() or $query->result() rather than returning $query, but that's up to you.

If you're getting duplicates when doing it this way, you should probably check your data.
Reply


Messages In This Thread
RE: How can i make model query based on images - by mwhitney - 08-20-2015, 07:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB