[PHP/MySQL] Concept Help

So I’m working on a project and I’m thoroughly stuck. I’m not sure if I need code help or maybe just concept help.

Essentially what’s going on is I have a database full of events which are pulled on to a calendar. The events are structured by employee ID (referencing the employee table) and a start date and end date in the form of unix timestamps.

The way I pull out data right now is I search for all events under a certain project between the start date and the end date and order by employee id. So I get an array that might look something like this:
employee 1: project a, date x1 through date y1
employee 2: project a, date x2 through date y2
employee 3: project b, date x3 through date y3.

This all works hunky dory, my issue arises when I pull out data for the same employee with multiple events in a time frame. So I’ll get.
employee 1: project a, date x1 through date y1
employee 1: project a, date x2 through date y2
employee 2: project b, date x3 through date y3

I’m using the mysql_get_array function so the array structure creates a key for each event, rather than each employee, so when I do a while loop in the PHP code I end up getting a new line for each event rather than employee. This leads to a table row for one employee followed by a table row for the same employee with a different event. Obviously it would make more sense for this to be all on one line.

I know this is all over the place, and I’ll probably have to post some code at some point, but for now I’m just conceptually looking for ideas on how to tackle this. It’s not imminent, I’m pushing this feature (or bug fix, depending on view) to the second beta which will probably be a week or two from now.

But any help would be awesome. Writing calendaring apps is a behotch.