Welcome Guest, Not a member yet? Register   Sign In
Pagination problem.

One more problem, is it possible to listing in our pages, two another $result tables? I.E I have $results1, which contains 50 elements, and $results2 which contains 20 elements. My $per_page parameter is set on 25. So is it possible to make it that, the first two pages will be from $results1 table, and the third from $results2?

Possible? Yes, but maybe in a tricky PHP way...

The pagination would be..

Now, the worst part is selecting the data. Since you'll have to determined if the current page is only the table 1, or table 1 with some part of table 2, or only table 2. It's possible, with some logic behind.

OR, you could use UNION in the query to select data from 2 tables at the same time. With some aliasing them to have the same fields name, it might work.

I've never used UNION, so I cannot suggest anything more, but it shouldn't be too hard...

The only problem I could imagine is: the query might be slow on a big result. Running query 2 times could be better, but you will need some logic to determine what are the source tables, 1, 1+2, or only 2.

Your choice. Smile

Theme © iAndrew 2016 - Forum software by © MyBB