CodeIgniter Forums

Full Version: Using pagination class with join and where?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]mdriscol[/eluser]
Hey guys/gals. I'm having some trouble figuring out how to do a pagination with a query that has two joined tables.

It's for an image gallery so the first table is for the gallery name called "gallery_event" and id and the second table is for the photos called "gallery_photo".

So photos are associated with a gallery.

I want to display 3 events on a page and all the photos associated with the gallery event. The photos have a column named "id_event" so it will join "id_event" with the "id" column from "gallery_event".

If I just use countall, it seems I can only count the total entries of one table but I need to know the total entries of 3 events plus all the photos joined with the same ID as the event id that I have assigned for the gallery.

How can I accomplish this? Let me know if its confusing.

El Forum

[eluser]mdriscol[/eluser]
Well, I got it to display a total number of rows for one page. I set it to 100 rows but it will cut off a gallery on one page and start it on the next because each gallery has a different number of photos. So I guess this will work but I'd like to have it somehow group the galleries and if the gallery goes over the number of rows for the page then it should put it to the next page. I guess I'll work on that. anybody have a clue?

example here: http://www.csusbrecsports.com/outdoors/w...were_here/