listing schedule time interval and client appointment

I am php newbie and I don't know if I am approaching this properly.
I need to creat a scheduler that list the appointment time on the left
and client for a specific appointment time on the left.

NOTE: The appointments are stored in a Mysql database

This is what I am trying to acomplish:
Time interval for appointments are 10 min or 15 min or 30 min, for
this example it is 60 mins

Time | client Name
09:00 AM |
10:00 AM | John Smith
11:00 AM |
09:00 PM | Mike Smith

I am getting the time interval on the right to display,
The problem I am having is getting the client name to line up with the
appointment time intervals on the right.

This is what I am getting with the code below:

Time | client Name
09:00 AM | John Smith
10:00 AM | Mike Smith
11:00 AM |
09:00 PM |

PHP Code:
/**--------------------------time interval--------------------**/
  //array with time interval listing found on the left side of the page
$time_60min_array = array(
'06:00 AM''07:00 AM''08:00 AM''09:00 AM''10:00 AM''11:00 AM'
'12:00 PM''01:00 PM''02:00 PM''03:00 PM''04:00 PM''05:00 PM'
'06:00 PM''07:00 PM''08:00 PM''09:00 PM');
/**-------------select appointment from database-----------------**/
  // select by date to match to time interval listing
$query "SELECT distinct(event_id), event_date, event_time, 
                         event_am_pm, first_name, last_name, 
              FROM cal_appointment 
          WHERE event_date = '
          ORDER BY event_date, event_am_pm, event_time"

$result mysqli_query($mysqli$query) or die('Error, query failed');
  //Note:<html> open layers and <tables> tags and title goes here

$result mysqli_query($mysqli$query) or die('Error, query failed');

$row_count count($time_60min_array);//count time interval in array

for($i=0$i $row_count$i++)
$row mysqli_fetch_array($result); 
$event_am_pm,$first$last) = $row;
//format time
$appoint_time $event_time." ".$am_pm;
//time interval
$interval =  $time_60min_array[$i];
//match appointment time on right to time listing on left          
if(in_array($appoint_time,  $interval))
$s_event_id $event_id
$client_name $last.", ".$first;
//display list
echo"<tr height=\"10\">
        <td width=30% height=\"10\" bgcolor=\"
        <td width=\"70%\"  height=\"10\" bgcolor=\"
                               <span class=\"style20\">
//Note: </html> end layers and </table>