I am working on an page that will print scheduled classes and appointments after querying a databse for them. Right now I'm trying to store the names of people with appointments in an array so I can print it after adding the classes as well. I've gotten stuck on this part and was hoping someone knew where the problem is in my code.
$appointments = mysql_query("SELECT * FROM appointment WHERE (teacherid = $id AND weekof = '$weekOf[0]-$weekOf[1]-$weekOf[2]')");
$periods = array('M1'=>'F','M2'=>'F','M3'=>'F','M4'=>'F','M5'=>'F','M6'=>'F','M7'=>'F'
,'M8'=>'F','T1'=>'F','T2'=>'F','T3'=>'F','T4'=>'F','T5'=>'F','T6'=>'F','T7'=>'F','T8'=>'F',
'W1'=>'F','W2'=>'F','W3'=>'F','W4'=>'F','W5'=>'F','W6'=>'F','W7'=>'F','W8'=>'F',
'H1'=>'F','H2'=>'F','H3'=>'F','H4'=>'F','H5'=>'F','H6'=>'F','H7'=>'F','H8'=>'F',
'F1'=>'F','F2'=>'F','F3'=>'F','F4'=>'F','F5'=>'F','F6'=>'F','F7'=>'F','F8'=>'F');
if (mysql_num_rows($appointments) != 0)
{
while ($row = mysql_fetch_row($appointments))
{
foreach ($periods as $key=>$period)
{
for ($i = 5; $i < 45; $i++)
{
if ($row[$i] == 'T')
{
if ($period == 'F')
{
$period = $row[$i];
}
else
{
$period = $period . '<BR />' . $row[$i];
}
}
}
}
}
}
The query returns id, Firstname, Lastname, Teacherid, Weekof, M1,M2,M3... Through F8 (40 total), and Date Created (in that order).
Thanks for any assistance.