Code: Select all
<?php require_once('../Connections/NWRC.php'); ?>
<?php
$alpha = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
mysql_select_db($database_NWRC, $NWRC);
for ($n=0;$n<26;$n++)
{
$query_rs_students_$alpha[$n] = "SELECT * FROM student_accounts WHERE last_name LIKE '$n%' ORDER BY last_name ASC";
$rs_students_$alpha[$n] = mysql_query($query_rs_students_$alpha[$n], $NWRC) or die(mysql_error());
$row_rs_students_$alpha[$n] = mysql_fetch_assoc($rs_students_$alpha[$n]);
$totalRows_rs_students_$alpha[$n] = mysql_num_rows($rs_students_$alpha[$n]);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>List Students</title>
</head>
<body>
<table width="200" border="1">
<tr>
<td nowrap="nowrap">Last Name </td>
<td nowrap="nowrap">First Name </td>
<td nowrap="nowrap">User Name </td>
<td>Password</td>
</tr>
<tr>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap">F</td>
<td nowrap="nowrap"> </td>
<td nowrap="nowrap"> </td>
<td> </td>
</tr>
<?php
for ($i=0;$i<26;$i++)
{ ?>
<?php do { ?>
<tr>
<td><?php echo $row_rs_students_'$alpha[$i]'['last_name']; ?></td>
<td><?php echo $row_rs_students_'$alpha[$i]'['first_name']; ?></td>
<td><?php echo $row_rs_students_'$alpha[$i]'['user_name']; ?></td>
<td><?php echo $row_rs_students_'$alpha[$i]'['password']; ?></td>
</tr>
<?php } while ($row_rs_students_'$alpha[$i]' = mysql_fetch_assoc($rs_students_'$alpha[$i]')); ?>
<?php } ?>
</table>
</body>
</html>
<?php
for ($free=0;$free<26;$free++)
{
mysql_free_result($rs_students_'$alpha[$i]');
}
?>