Ok, here's the problem...
I'm generating a timesheet, which links a "people" table to a "timesheet" table as follows:
people
people_key
name
timesheet
timesheet_key
people_fkey
timesheetdate
numhours
Now I'm writing the script that draws the timesheet for a given week. It does a left join from people to timesheet, where timesheetdate is within the given week range OR where timesheetdate is null. This means if they have no data in the timesheet table, it'll still pull them out, using the null record created using the LEFT join.
I then loop around the returned results outputting the weeks hours (moving to the next record when I hit each day, or if that day doesn't exist, it just outputs no hours and tries the next one)...
HOWEVER... If a person has some data in the timesheets table for a week other than the given week, it doesn't create the null record from the LEFT join, as it has data. These rows are then dropped because they don't match the date, so this person doesn't end up in the resulting rows, and therefore doesn't appear on the timesheet.
Any ideas? Feel free to ask questions.