Q:

PHP: Start while loop at specific rows on SQL table

I'm just wondering how I could fetch data using a while loop at row 5 in my SQL table and end it at row 8.
Here is an example of my current code:
while($row = $results->fetch(PDO::FETCH_ASSOC))
                        {
                        echo '
                        <li>Mileage: '.number_format($row["Mileage"]).'</li>
                        <li>Engine size: '.$row["EngineSize"].'cc</li>
                        ';} ?>

So as you can see I'd like to make it so the while loop only loops from row 5 to row 8 so I'd be left with 4 li's with the unique data in those columns. As it stands it is currently looping every row in the SQL table which is what I don't want.
Any code examples would be great as I am really stuck on this at the moment. Thanks.

A:

MySQL developers and SQL designers must have actually been able to predict this question years back. :)
LIMIT clause comes to your rescue
http://www.mysqltutorial.org/mysql-limit.aspx

