Reputation: 43
$com = $conn->prepare("select * from comments where com_vid_id=? order by likes desc");
On this query if my result is: A, D, C, G, B, K, R, T, Q, Z, V ....
I want to make the result like this: K, R, T, Q, Z, V ....
How to pass first five records in query ?
Upvotes: 0
Views: 67
Reputation: 1016
use LIMIT and OFFSET
$com = $conn->prepare("SELECT * FROM comments WHERE com_vid_id=? ORDER BY likes DESC LIMIT 100 OFFSET 5");
Upvotes: 2