I have some code here that gets the nth row from db. Problem is that it sometimes skips a row or few rows or just misses it. The f_id
is set to auto increment with no gaps. Regardless it should not skip any f_id, what am doing wrong?
$sql2 = mysql_query("SELECT *
FROM (
SELECT
@row := @row +1 AS rownum, price,f_id, car, color
FROM (
SELECT @row :=0) r, $tbName WHERE (car= '$car') $color $location AND (price BETWEEN '".$min."' AND '".$max."')
) ranked
WHERE rownum %25 =1 order by price ASC, f_id ASC");
I noticed that the WHERE
section does not work properly when using the OR
exp AND (color = 'green' OR color = 'red')
it sometimes skips the red color. Any ideas?