Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8039343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:32:26+00:00 2026-06-05T03:32:26+00:00

I got a minor problem. To start, I have the following tables: ‘groups’, ‘pages’

  • 0

I got a minor problem. To start, I have the following tables: ‘groups’, ‘pages’ and the junction table ‘subcriptions’

The idea behind this is that a group (with users) can subsribe to a page. An user can add a page as a subscription to the group he is in. (many-to-many). For information: An user can be in multiple groups.

As a part of the UI I want to make a list about that. From every group I want the associated pages. For example: (Group: … Pages: -…. , -…. | Group: … Pages: -…., -…. etc.)

The SQL query is not a issue:

SELECT Groups.name, pages.name, pages.id
FROM Groups
JOIN subscriptions ON groups.id = subscriptions.group_id
JOIN pages ON subscriptions.page_id = pages.id
WHERE groups.id IN ('1', '2')   // de values 1 & 2 zijn voorbeelden en stellen de groepen id's voor waarin de huidige gebruiker zit.

The result will, for example, look like this:

group name ---- page name ---- page id
group1 -------- page1 --------- 1
group1 -------- page2 --------- 2  
group2 -------- page1 --------- 1

My question is; how can I get a (html) list where I get a single group-name and all the associated pages to that group? (Like the example I mentioned earlier). I need a php solution. (I am using Zend framework, but I could not find a solution in Zend that does the trick I want)

Or do have to do a single query for every group? I would like to avoid that though..

I am new in this world of mysql and php so every help is worth allot! Thanks. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:32:27+00:00Added an answer on June 5, 2026 at 3:32 am

    a very basic implementation would be the following:

    • loop through mysql results
    • build a 2-dimensional array with the group as your 1st and the associated pages as 2nd dimension
    • in your html template, take your array and use an outer loop to go through your groups and an inner loop to get the pages per group

    cheers 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had the following (minor but nagging!) problem: I've got a PreferenceActivity with a
I've got a pretty minor problem that I think can be resolved by re-thinking
I've got a minor problem with my jQuery gallery, and I assume it's related
I've got a minor problem with a database admin page that I use to
Got a problem with Apache and PHP-files of Wordpress. When I go to any
got a problem, can't get my head around this jquery and would appreciate your
Got datatable with Id, parentId, description. It is a relationial table structure. I want
I've got a ListView that works just great, except for this minor annoyance. I
I have got an Entity model which contains a collection of Message objects which
I have a debugging problem with a project. This project is not the best

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.