Jump to content

Help with Mysqli and Limits


runnerjp

Recommended Posts

Hi,

 

Im using Mysqli and im trying to limit the results by 10 and order them from last to first from the database.

$sqlhorses = "SELECT Place FROM `*` WHERE `Horse` ='".$db->real_escape_string($row['horse']). "'";

the above works but when i added the limit 6 to the end it shows errors.

 

Can anyone help?

Link to comment
https://forums.phpfreaks.com/topic/292392-help-with-mysqli-and-limits/
Share on other sites

Did you mess up the positions of that wildcard? *

 

I would hope the data already in your database is safe.

$sqlhorses = "SELECT * FROM Place WHERE `Horse` ='".$row['horse']. "' GROUP BY id DESC LIMIT 10";

Sounds like you need pagination, there is an old tutorial here at phpfreaks can follow, but should make it mysqli or pdo

http://www.phpfreaks.com/tutorial/basic-pagination

 

with pagination would also include the startrow

GROUP BY id DESC LIMIT 0,10

GROUP BY id DESC LIMIT 9,10

GROUP BY id DESC LIMIT 19,10

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.