Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Setting query greater than previously declared limit

I am trying to declare 2 queries: one that has a limit of the first 6 entries, and the other that displays the rest of the entries. Is this possible? How can one do so?

Here is my code:

// displays the first 6 entries
$Student_Names = $wpdb->get_results("SELECT Student_First_Name, Student_Last_Name FROM Student LIMIT 6");

// how to display rest of table entries Excluding the first 6 displayed above
$Student_Names_Full = $wpdb->get_results("SELECT Student_First_Name, Student_Last_Name FROM Student");

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Just use OFFSET

$Student_Names_Full = $wpdb->get_results("SELECT Student_First_Name, Student_Last_Name FROM Student LIMIT 9999 OFFSET 6");

you have to choose best value for limit.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading