Hi all,
I have one table called tasks that has a taskid (autonumber).
I have several other tables called task1 - task2 etc according to the taskid.
These task1, task2 etc tables contain a userid and a date the task was completed.
Once the record is deleted in the tasks table the corresdponding task table is deleted.
What I would like to do is extract the task numbers from the task table and count them.
Then I would like to search the individual task tables and count the occurences of an id (stored in page variable as $id) for todays date.
Subtract one from the other and what that should give me is the number of tasks a user has left to do today.
I can do the first part which is to count the number of rows in the task table.
Then for the various task tables I was thinking an array from the main table which would create the table names, then loop a query through these tables to find the id and todays date if it existed. If it does add one to another variable which will be my result otherwise add 0.
The result should give me the two variables:
the total number of tasks
the number of tasks completed today
Can anyone help me achieve this.
Many thanks in advance for your help.
loop through tables that may / may not exist!
Moderator: General Moderators
-
bigfatwallet
- Forum Newbie
- Posts: 2
- Joined: Fri Apr 01, 2005 6:13 am
-
bigfatwallet
- Forum Newbie
- Posts: 2
- Joined: Fri Apr 01, 2005 6:13 am
Yes they are all exaclty the same structure. Ideally it would be better to have two tables - one task and one action.
The tables are set that way because the script I purchased creates them that way. It's not out of choice!
I am just trying to be different to the standard scripts by providing my members with the info they want without having to re-code the whole script.
The tables are set that way because the script I purchased creates them that way. It's not out of choice!
I am just trying to be different to the standard scripts by providing my members with the info they want without having to re-code the whole script.