How can I limit the amount of results returned?
$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type = 'attachment'
AND ID in ($meta)
ORDER BY menu_order ASC
");
|
How can I limit the amount of results returned?
|
|||
|
|
Like @Kaiser suggested you can specify a range (5th to 20th results, a total of 15 results are returned at max) like this:
|
||||
|
As an addition to @Ashfame Answer: You can not only set a "hard" limit, but also a range, using |
|||||
|
|
Why not just use
I always prefer function calls to raw DB queries. |
|||||||||
|