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

  • SEARCH
  • Home
  • 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 219729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:52:20+00:00 2026-05-11T18:52:20+00:00

I have a MySQL database containing these tables: sessions ——– sessionid (INT) [courseid (INT)]

  • 0

I have a MySQL database containing these tables:

sessions
--------
sessionid (INT)
[courseid (INT)]
[locationid (INT)]
[comment (TEXT)]

dates
-----
dateid (INT)
sessionid (INT)
date (DATE)

courses
-------
...

locations
---------
...

Each session has a unique sessionid, and each date has a unique dateid. But dates don’t necessarily have a unique sessionid, as a session can span over a variable number of dates (not necessarily consecutive).

Selecting each full row is simply a matter of joining the tables on the sessionid. However, I’m looking for a way to return a rowset for a particular courseid, where each row in that rowset represents a location, and contains another rowset, each containing single session, which in turn contains another rowset, which contains all of the dates for that session:

course
    location
        sesssion
            date
            date
        session
            date
            date
            date
    location
        ...

This is because I’m using querying this database from PHP using Zend Framework, which has a great interface for manipulating rows and rowsets in an object-oriented manner.

Ultimately, I’m trying to output a ‘schedule’ to the view, organized first by course, then location, then date. Ideally, I’d be able iterate over each row as a location, and then for each location, iterate over each session, and then for each session, iterate over each date.

I’m thinking of doing this by querying for all the locations, sessions, and dates separately. Then, I’d convert each rowset into an array, and add each sessions array as a member of a locations array, and add each dates array as a member of a sessions array.

This, however, feels very kludgy, and doesn’t provide me with the ability to handle the rows in an object-oriented manner.

I was wondering if there was either:

a) a better table schema for representing this data;

b) an sql query which i’m not aware of;

c) a method in Zend_Db that allows me to assign a rowset to a rowset

Please let me know if I haven’t been clear anywhere, and thanks in advance.

(Crossing my fingers that this doesn’t end up on the daily wtf…)

  • 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-05-11T18:52:20+00:00Added an answer on May 11, 2026 at 6:52 pm

    I’ve run into lots of issues with using Zend Frameworks database abstraction classes when I have to deal with data from multiple tables. The number of queries that run and the overhead of all of the objects generated has brought my hosting server to it’s knees. I’ve since reverted back to writing queries to gather all of my data and then walking the data to build my display. It’s not a pretty or OO as using the abstraction layers but it’s also not making my PHP scripts page to disk just to display a table full of data.

    As Steve mentions benchmark whatever solution you end up with, I’d also profile your memory usage.

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

Sidebar

Ask A Question

Stats

  • Questions 100k
  • Answers 100k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If I were you I'd get a copy of Sysinternals… May 11, 2026 at 7:59 pm
  • Editorial Team
    Editorial Team added an answer I wrote Truss to fill the void. May 11, 2026 at 7:59 pm
  • Editorial Team
    Editorial Team added an answer The Z22 runs palmos 5 so it should run the… May 11, 2026 at 7:59 pm

Related Questions

I have a database with 2 tables. One of the tables holds a row
I have a big load of documents, text-files, that I want to search for
After reading through many of the questions here about DB schema migration and versions,
I have a mysql table containing the values for 'display' and 'link'. I'd like
I am trying to send a php script some content to be stored in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.