I am actually facing a problem that I am unable to find out why is this happening, I've spent many hours but couldn't find any resolution, I would highly appreciate your help.
Well the case is:
I am pulling some COLUMNS from TRACKS table and those are order by two columns TRACKS.SPOTLIGHT and TRACKS.ID
Spotlight column only contains 1 or 0 values while tracks id's are 1,2,3,4 ... 500 all unique,
and they have a perpage limit of 20 records.
Now when I open up these records pull up correctly in the browser as I wanted the first 20 records show absolutely perfect and spotlight that has value 1 are on the top (that's what I wanted).
Now when I load more (next set of 20 records)
It is now repeating the spotlight track again + showing the rest track id's in DESC order.
The problem is I want to prevent the spotlight to repeat on every page loop.
Can someone help me with what I am doing wrong.
Thanks alot guys,
here is my code
function searchTracks($start, $value) { // If the $start value is 0, empty the query; if($start == 0) { $start = ''; } else { // Else, build up the query $start = 'AND tracks.id db->real_escape_string($start).'\''; } $query = sprintf("SELECT * FROM `tracks`, `users` WHERE (`tracks`.`title` LIKE '%s' OR `tracks`.`description` LIKE '%s' OR `tracks`.`tag` LIKE '%s' OR `tracks`.`record` LIKE '%s' ) AND `tracks`.`uid` = `users`.`idu` %s AND `tracks`.`public` = 1 ORDER BY tracks.spotlight DESC, tracks.id DESC LIMIT %s", '%'.$this->db->real_escape_string($value).'%', '%'.$this->db->real_escape_string($value).'%', '%'.$this->db->real_escape_string($value).'%', '%'.$this->db->real_escape_string($value).'%', $start, ($this->per_page + 1)); return $this->getTracks($query, 'searchTracks', '\''.$value.'\''); }