PHP Pagination with 4 seperate mySQL queries

Hi all

I have a question regarding whether it’s possible to have 4 mySQL queries and then paginate the results from all 4 into one list?

Basically, I have 2 tables and four types of advert I want to display. They are one filtered result from one mySQL table 1st, then a different filtered result from the same table, then a 3rd result from the 2nd table and a 4th result from the 2nd table. All of these results will be a large list that I then want to split into 10 results per page.

Is this possible?

The reason I have 4 different queries is because I want a different

shown in each.

Many thanks for your help.

Pete

I would suggest to try to combine 4 queries into 1, if possible. You can then use some field or criteria to identify each of 4 different types of records while you output results, so that you can use corresponding html markup.

If there is no way to combine 4 queries into one, you still can merge results into an array, and have pagination for resulting merged array. But depending on data volume, this method may require more server resources, and also time to generate result.

Sponsor our Newsletter | Privacy Policy | Terms of Service