I am trying to only select the difference between $from
and $to
and have those rows outputted in descending order. The problem so far is that I am inputting '5' in as the $from
value and '10' into the $to
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());
It's not FROM and TO, it's FROM and HOWMANY.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With