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

(This post was last modified: 08-21-2015, 03:22 AM by freddy.)

(08-20-2015, 07:33 AM)mwhitney Wrote:
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.

Sorry late respons cause i'm doing responsive design  Confused by the way why you change query becom limit 2 mwhitney  all i want is take  4 data then my problem now is show the third and also 4 in other hand i have been tested it delete one when data still 4 it give me duplicate data which should only show data with row 3 then i delete again till data 2 it also duplicate, will you give me example how to show it with right ways


Thanks for respond ya 
Reply


Messages In This Thread
RE: How can i make model query based on images - by freddy - 08-21-2015, 03:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB