control functions executing in the wrong order
Posted: Wed Feb 22, 2006 6:53 pm
So here is what I have, the switch control is obviously before the while control:
and here is what prints out:
Amanda Roberson
President
Senior
Public Relations
Email
Officers
The heading for the lists (created by the switch) is always under the list it self (created by the while)
I am totally stumped.
Code: Select all
foreach ($offices as $status){
switch($status):
case 'President':
print "<h1> Officers </h1>";
break;
case 'Active':
print "<h1>Active Members</h1>";
break;
case 'Pledge':
print "<h1>Pledges</h1>";
break;
default:
endswitch;
$query = "SELECT * from mgmemberpage WHERE status = '$status' ORDER BY last_name ASC";
$result = mysql_query($query, $conn);
while ($memberinfoarray = mysql_fetch_array($result)){
?>
<tr>
<td>
<p class="membername"><?php print $memberinfoarray['first_name']." ".$memberinfoarray['last_name']; ?><br />
<p class="members"><?php print $memberinfoarray['status']?><br />
<?php print $memberinfoarray['year']; ?><br />
<?php print $memberinfoarray['major']; ?><br />
<a href="http://www.millergirls.org/email.php?email=<?php print $memberinfoarray['id']; ?>">Email <?php print $memberpagearray['first_name']?></a><br /></p></p>
</td>
</tr>
</table>
<?php
}
}and here is what prints out:
Amanda Roberson
President
Senior
Public Relations
Officers
The heading for the lists (created by the switch) is always under the list it self (created by the while)
I am totally stumped.