max_ max_ - 4 months ago 6x
SQL Question

MySQL Query selecting too many rows

I am trying to only select the difference between

and have those rows outputted in descending order. The problem so far is that I am inputting '5' in as the
value and '10' into the
value, but it seems to be outputting 10 rather than 5.

Please could you tell me where I am going wrong?

$query = mysql_query("SELECT * FROM `Posts` WHERE `isPublic` = 'yes' ORDER BY `date` DESC LIMIT $from,$to") or die(mysql_error());


Check this out: SELECT MySQL documentation.

What you are doing by LIMIT 5, 10 is a synonym to LIMIT 10 OFFSET 5 (get 10 results skipping 5 results from the beginning of the set returned by database).