bagpiperdude90 Posted December 6, 2007 Share Posted December 6, 2007 Ok, I have been asked by my church to write a website to allow people to sign up for childcare (especially infant and toddler nursery). I've got all my databases setup - basically, they are like this: infants_0900 date (mm/dd/yy) - adult_1 - adult_2 - adult_3 - teen the user id (for example, we will use 28 as the user id) is placed in the adult_1, 2, 3, or the teen cell when they sign up to work in that spot. So, as you can see, each week, there are for helpers - 3 adults, and one teen. There are four of those tables, infants_0900, infants_1045, toddlers_0900, toddlers_1045 . The numbers are for the service times (9:00am and 10:45am). Now, I am also hoping to later on be able to let an admin add more classes (say, a 2nd grade class, with two adults), so I want to keep each table setup the same, with the same column names, etc. But, I have run into a problem. Lets say a volunteer has signed up in all four of the nursery classes, but now wants to know when and where they are working. I'm writing a page to grab the date entry in the table wherever adult_1, 2,3 or teen has their user id. $q = "SELECT `date`, `teen` FROM infants_0900 WHERE teen = $userid ORDER BY date"; Now, I am running that query on all four tables. I could go ahead and print the results from all of them on the page. However, they would not be ordered by the date, but ordered by the table it came out of, then by the date. For instance, I grab the data from infants_0900 first, then infants_1045. Lets say on 07/07/08 the user is working in infants_0900. On 06/07/08, they are working in infants_1045. Well, if I print the results from infants_0900 then infants_1045, the dates will appear as: 07/07/08 - Infants 9:00 06/07/08 - Infants 10:45 So, I'm thinking I need to merge all the results from the queries, then somehow sort them by the date column. I cannot join all or union on MySQL, because all the table structures are exactly the same - only the table names are different. Help! Thanks! Let me know if I need to be more clear on something. I can also post the code, if that would help. Quote Link to comment https://forums.phpfreaks.com/topic/80479-solved-ordering-php-arrays-for-a-sign-up-website/ Share on other sites More sharing options...
bagpiperdude90 Posted December 6, 2007 Author Share Posted December 6, 2007 I'm putting a resolved on this, because I decided building it differently would be best - now it will show different headers for each nursery class, followed by the dates they are serving on. Quote Link to comment https://forums.phpfreaks.com/topic/80479-solved-ordering-php-arrays-for-a-sign-up-website/#findComment-408017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.