are the officers id'ed by some column? if so then add
ORDER by COLUMN_NAME
bastien
From: Charles River <chas.river@xxxxxxxxx>
Reply-To: chas.river@xxxxxxxxx
To: php-db@xxxxxxxxxxxxx
Subject: Table sorting problem
Date: Thu, 12 Jan 2006 16:51:29 -0500
I am a novice in both PHP and MySQL, otherwise I would be able to do
this myself. :-)
A non-profit I assist has a table (<http://www.lbc4cc.org/04-05board.php>)
that is
displayed by a simple PHP script. That was fine last year, but now we
have some new officers and some new board members and I have no idea
how to change the script so that "Officers and Members" table is presented
officers first (Pres, Vice-pres, Sec and Treas) and then an alpha listing
of board members who are not officers.
The existing script looks like this:
<?php
$sql = "SELECT * FROM members";
$result=mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " .
mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
echo "<table cellspacing='0' border='1' cellpadding='2'
bgcolor='#FFFFCC' width='100%'>";
echo "<tr>\n";
echo "<th>Office</td>\n";
echo "<th>Name</td>\n";
echo "<th>Address</td>\n";
echo "<th>Phones</td>\n";
echo "<th>Church</td>\n";
echo "<th>Email</td>\n";
echo "<th>Term<br>Ends</td>\n";
echo "</tr>\n";
while ( $row = mysql_fetch_array($result,MYSQL_ASSOC) )
{
echo "<tr>\n";
if ($row['Office'] == " ") {
echo "<td> </td>\n";
} else {
echo "<td><b>{$row['Office']}</b></td>\n";
}
echo "<td>{$row['Name']}</td>\n";
echo "<td>{$row['Address']}</td>\n";
echo "<td>{$row['Phone']}</td>\n";
if ($row['Church'] == "") {
echo "<td> </td>\n";
} else {
echo "<td>{$row['Church']}</td>\n";
}
if ($row['Email'] == "") {
echo "<td> </td>\n";
} else {
echo "<td>{$row['Email']}</td>\n";
}
echo "<td>{$row['Term']}</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
?>
Can some kind soul bang out the code I need? Thanks.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php