I'm looking to update my member list, Since certain states will have more members, I've decided to go with a "single list" approach. I found the following code from this site, which I have modified for my purposes:
[PHP]$columns = 3;
$query = Non Admins;
$result = mysql_query($qu ery);
$num_rows = mysql_num_rows( $result);
//we are going to set a new variables called $rows
$rows = ceil($num_rows / $columns);
//to do this display, we will need to run another loop
//this loop will populate an array with all our values
while($row = mysql_fetch_arr ay($result)) {
$data_row = $row['Number'].'-'.$row['FirstName'].' '.$row['LastName'];
$data[] = $data_row;
}
echo "<TABLE BORDER='0'>\n";
echo "<tr>\n<td valign='top' width='25%'>\n" ;
$querymem = Admins;
$sqlmem = mysql_query($qu erymem) or die(mysql_error ());
while ($rowmem = mysql_fetch_arr ay($sqlmem))
{
$number = $rowmem['Number'];
$fullname = $rowmem['FirstName']." ".$rowmem['LastName'];
echo "<p><b><fon t color='#FFCC00' ><a href='member.ph p?name=$number' >".strtoupper($ number)."</a></font></b><br />".ucwords($ful lname)."</p>\n";
}
echo "</td>\n</tr>\n";
//here we changed the condition to $i < $rows
for($i = 0; $i < $rows; $i++) {
echo "<TR>\n";
//here will run another loop for the amount of columns
for($j = 0; $j < $columns; $j++) {
if(isset($data[$i + ($j * $rows)])) {
$member_info = explode("-", $data[$i + ($j * $rows)]);
$number = $member_info[0];
$name = $member_info[1];
echo "<TD valign='top' width='25%'>";
echo "<b><a href='member.ph p?name=$number' >".strtoupper($ number)."</a></b>";
echo "<br />".ucwords($nam e);
echo "</TD>\n";
}
}
echo "</TR>\n";
}
echo "</TABLE>\n";[/PHP]
You can see the results on my test page. So I'm trying to figure out a way to still have the one column for administrators only, and the regular members to be in the other columns.
[PHP]$columns = 3;
$query = Non Admins;
$result = mysql_query($qu ery);
$num_rows = mysql_num_rows( $result);
//we are going to set a new variables called $rows
$rows = ceil($num_rows / $columns);
//to do this display, we will need to run another loop
//this loop will populate an array with all our values
while($row = mysql_fetch_arr ay($result)) {
$data_row = $row['Number'].'-'.$row['FirstName'].' '.$row['LastName'];
$data[] = $data_row;
}
echo "<TABLE BORDER='0'>\n";
echo "<tr>\n<td valign='top' width='25%'>\n" ;
$querymem = Admins;
$sqlmem = mysql_query($qu erymem) or die(mysql_error ());
while ($rowmem = mysql_fetch_arr ay($sqlmem))
{
$number = $rowmem['Number'];
$fullname = $rowmem['FirstName']." ".$rowmem['LastName'];
echo "<p><b><fon t color='#FFCC00' ><a href='member.ph p?name=$number' >".strtoupper($ number)."</a></font></b><br />".ucwords($ful lname)."</p>\n";
}
echo "</td>\n</tr>\n";
//here we changed the condition to $i < $rows
for($i = 0; $i < $rows; $i++) {
echo "<TR>\n";
//here will run another loop for the amount of columns
for($j = 0; $j < $columns; $j++) {
if(isset($data[$i + ($j * $rows)])) {
$member_info = explode("-", $data[$i + ($j * $rows)]);
$number = $member_info[0];
$name = $member_info[1];
echo "<TD valign='top' width='25%'>";
echo "<b><a href='member.ph p?name=$number' >".strtoupper($ number)."</a></b>";
echo "<br />".ucwords($nam e);
echo "</TD>\n";
}
}
echo "</TR>\n";
}
echo "</TABLE>\n";[/PHP]
You can see the results on my test page. So I'm trying to figure out a way to still have the one column for administrators only, and the regular members to be in the other columns.
Comment