I'm writing a php/mysql application to manage my contact reports for work. I've got two tables, one contains the info from the report ('reports') and the other contains actions that I must complete after the visit. This is what that table looks like. It's called 'actions':
action_id varchar(50)
action varchar(100)
due date
completed char(1)
action2 varchar(100)
due2 date Yes NULL
completed2 char(1)
action3 varchar(100)
due3 date
completed3 char(1)
action4 varchar(100)
due4 date
completed4 char(1)
Each contact might have 1, 2, 3 or 4 actions to complete, each with a corresponding due date. Table 'reports' contains the contact's name, address, telephone, comments, etc. The tables are linked by action_id.
Basically, I want to display, using an html table, all the actions in descending order (regardless of what column they are in the 'actions' table) and the contact name that corresponds to the action. One caveat is that if the 'completed' field is not null, then the action has been completed and shouldn't be displayed. Here's what I'm trying to get the table to look like:
Name Date Due
(from 'reports') (either due, due2, due3 or due4)
Is this even possible? Thanks in advance...