Here is the entire revised code
<php><?php
// Connect to database
include_once "connect_to_mysql.php";
// DEAFAULT QUERY STRING
$queryString = "WHERE email_activated='1' ORDER BY id ASC";
// DEFAULT MESSAGE ON TOP OF RESULT DISPLAY
$queryMsg = "Showing Oldest to Newest members by Default";
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// SET UP FOR SEARCH CRITERIA QUERY SWITCH MECHANISMS
if (($_POST['listByq'] == "newest_members")) {
$queryString = "WHERE email_activated='1' ORDER BY id DESC";
$queryMsg = "Showing Newest to Oldest Members";
} else if ($_POST['listByq'] == "by_firstname") {
$fname = $_POST['fname'];
$fname = stripslashes($fname);
$fname = strip_tags($fname);
$fname = eregi_replace("`", "", $fname);
$fname = mysql_real_escape_string($fname);
$queryString = "WHERE firstname LIKE '%$fname%' AND email_activated='1'";
$queryMsg = "Showing Members with the name you searched for";
}
/////////////// END SET UP FOR SEARCH CRITERIA QUERY SWITCH MECHANISMS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////// QUERY THE MEMBER DATA USING THE $queryString variable's value
$sql = "SELECT id, firstname, lastname, country, website FROM myMembers $queryString" ;
echo $sql ;
$result = mysql_query($sql);
//////////////////////////////////// Pagination Setup ////////////////////////////////////
?>
// Build the Output Section Here
$outputList = '';
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$firstname = $row["firstname"];
$lastname = $row["lastname"];
$country = $row["country"];
/////// Mechanism to Display Pic. See if they have uploaded a pic or not //////////////////////////
$check_pic = "../memberFiles/$id/pic1.jpg";
$default_pic = "../memberFiles/0/pic1.jpg";
if (file_exists($check_pic)) {
$user_pic = "<img src=\"$check_pic\" width=\"120px\" border=\"0\" />"; // forces picture to be 120px wide and no more
} else {
$user_pic = "<img src=\"$default_pic\" width=\"120px\" border=\"0\" />"; // forces default picture to be 120px wide and no more
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$outputList .= '
<table width="100%">
<tr>
<td width="23%" rowspan="3"><div style=" height:120px; overflow:hidden;"><a href="http://www.hcrindienetwork.com/free/member_profile.php?id=' . $id . '" target="blank">' . $user_pic . '</a></div></td>
<td width="14%" class="style7"><div align="right">Name:</div></td>
<td width="63%"><a href="http://www.hcrindienetwork.com/free/member_profile.php?id=' . $id . '" target="blank">' . $firstname . ' ' . $lastname . '</a> </td>
</tr>
<tr>
<td class="style7"><div align="right">Country:</div></td>
<td>' . $country . ' </td>
</tr>
<tr>
</table>
<hr />
';
} // close while //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////// END QUERY THE MEMBER DATA & Build the Output Section ////////////////////////////
?>
<!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" />
<meta name="Description" content="Member Browsing" />
<meta name="Keywords" content="" />
<meta name="rating" content="General" />
<meta name="ROBOTS" content="All" />
<title>Browse Members</title>
</head>
<body>
<table width="950" align="center">
<tr>
<td width="758" valign="top"><br />
<table width="94%" align="center" cellpadding="6">
<tr>
<td bgcolor="#E9E9E9"><form id="form1" name="form1" method="post" action="member_search.php">
Browse Newest Members
<input name="button" type="submit" id="button" value="Go" />
<input type="hidden" name="listByq" value="newest_members" />
<td bgcolor="#E9E9E9"><form id="form3" name="form3" method="post" action="member_search.php">
Search By Name
<input type="text" name="fname" id="fname" />
<input name="button3" type="submit" id="button3" value="Go" />
<input type="hidden" name="listByq" value="by_firstname" />
</form></td>
</tr>
</table>
<br />
<table width="70%" align="center" cellpadding="6">
<tr>
<td><?php print "$queryMsg"; ?><br /><br />
<?php print "$outputList"; ?></td>
</tr>
</table>
<br />
<br /></td>
</tr>
</table>
</body>
</html>
</php>