Below is the full code, with the issue of:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM members WHERE emailactivated='1' ORDER BY id ASC LIMIT 5'
and
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
<?php
session_start(); // Must start session first thing
/*
This is the top stuff that nobody can see!
*/
// See if they are a logged in member by checking Session data
$toplinks = "";
if (isset($_SESSION['id'])) {
// Put stored session variables into local php variable
$userid = $_SESSION['id'];
$vibe = $_SESSION['vibe'];
$toplinks = '<a href="member_profile.php?id=' . $userid . '">Profile</a> •
<a href="http://www.sourcevibe.com">Account</a> •
<a href="logout.php">Log Out</a>';
} else {
$toplinks = ' <a href="http://www.sourcevibe.com">Register</a> • <a href="http://www.sourcevibe.com">Login</a>';
}
?>
<LINK REL="SHORTCUT ICON" HREF="http://www.sourcevibe.com/graphics/faveicon.gif">
<!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>
</td>
<LINK REL="SHORTCUT ICON" HREF="http://www.sourcevibe.com/graphics/faveicon.gif">
<title>Member Search</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" type="text/css" href="../default.css"><style>#bodydiv { height: 500px; }</style></head><body> <div id="container"> <div id="content">
<div id="navbar"> <br><br><br><br><?php include 'menu/menu.php'; ?>
</div> <div id="bodydiv">
<center>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-0568620827775779";
/* HCR Network wide ad ftw */
google_ad_slot = "5548393844";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><center>
<?php
// Connect to database
include_once "connect_to_mysql.php";
// DEAFAULT QUERY STRING
$queryString = "WHERE emailactivated='1' ORDER BY id ASC LIMIT 5";
// DEFAULT MESSAGE ON TOP OF RESULT DISPLAY
$queryMsg = "Showing Oldest to Newest members";
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////// SET UP FOR SEARCH CRITERIA QUERY SWITCH MECHANISMS
if (($_POST['listByq'] == "newest_members")) {
$queryString = "WHERE emailactivated='1' ORDER BY id DESC";
$queryMsg = "Showing Newest to Oldest Members";
} else if ($_POST['listByq'] == "fb_members") {
$queryString = "WHERE facebook !='' AND emailactivated='1' ORDER BY id DESC";
$queryMsg = "Showing Members with embedded facebook Profiles";
} else if ($_POST['listByq'] == "by_vibe") {
$vibeid = $_POST['vibeid'];
$vibeid = stripslashes($vibeid);
$vibeid = strip_tags($vibeid);
$vibeid = eregi_replace("`", "", $vibeid);
$vibeid = mysql_real_escape_string($vibeid);
$queryString = "WHERE vibe LIKE '%$vibeid%' AND emailactivated='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 = mysql_query("SELECT id, vibe, country, state, FROM members $queryString");
{
echo mysql_error();
}
//////////////////////////////////// Pagination Setup ////////////////////////////////////
// Build the Output Section Here
$outputList = '';
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$vibe = $row["vibe"];
$country = $row["country"];
$state = $row["state"];
/////// 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 style="width: 100%;">
<tbody>
<tr>
<td rowspan="4" width="23%">
<div
style="height: 120px; overflow: hidden;"><a
href="http://www.sourcevibe.com/account/member_profile.php?id=' . $id . '"
target="_blank">' . $user_pic . '</a></div>
</td>
<td class="style7" width="14%">
<div align="right">Name:</div>
</td>
<td width="63%"><a
href="http://www.sourcevibe.com/account/member_profile.php?id=' . $id . '"
target="_blank"><span style="color: rgb(0, 74, 128);">' . $vibe . '<span></a>
</tr>
<tr>
<td class="style7">
<div align="right">State:</div>
</td>
<td>'
. $state . ' </td>
</tr>
<tr>
<td
style="text-align: right; vertical-align: middle;">Country:</td>
<td>' . $country . ' </td>
<td></td>
</tr>
</tbody>
</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>
</head>
<body>
<table width="950" align="center">
<tr>
<td width="758" valign="top"><br />
<table width="94%" align="center" cellpadding="6">
<tr>
<td bgcolor="#004A80"><form id="form1" name="form1" method="post" action="member_search.php">
<span style="color: rgb(255, 255, 255);">Browse Newest Members</span>
<input name="button" type="submit" id="button" value="Go" />
<input type="hidden" name="listByq" value="newest_members" />
</form> </td>
<td bgcolor="#004A80"><form id="form2" name="form2" method="post" action="member_search.php">
<span style="color: rgb(255, 255, 255);">Browse Facebook Members</span>
<input name="button2" type="submit" id="button2" value="Go" />
<input type="hidden" name="listByq" value="fb_members" />
</form></td>
<td bgcolor="#004A80"><form id="form3" name="form3" method="post" action="member_search.php">
<span style="color: rgb(255, 255, 255);">Search By Name</span>
<input type="text" name="vibeid" id="vibeid" />
<input name="button3" type="submit" id="button3" value="Go" />
<input type="hidden" name="listByq" value="by_vibe" />
</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><center>You will need to narrow your search to find members not listed here.</center>
<br />
<br /></td>
</td>
</tr>
</table>
</body>
</html>
</div><div id="footer"></div><div id="underfooter"><p class="footer">
<img alt=""
src="http://harborcitysolutions.com/sourcevibe.com/graphics/layout/line.png"><br>
<a style="color: #35A2EA;" href="http://www.sourcevibe.com"><small>HOME</small></a>|<a style="color: #35A2EA;"
href="http://www.sourcevibe.com/account/member_search.php"> <small>MEMBER SEARCH</small></a>
| <a style="color: #35A2EA;" href="http://www.sourcevibe.com/aboutus.php"><small>ABOUT US</small></a>
| <a style="color: #35A2EA;" href="http://www.sourcevibe.com/contactus.php"><small>CONTACTUS</small></a><br>
<br>© 2013 Source Vibe. Project by <a style="color: #555; font-weight: normal !important;" href="http://www.harborcitysolutions.com"><small>Harbor City Solutions.</small></a> All Rights Reserved.
<br>
<a style="color: #CC0000;" href="http://www.sourcevibe.com/problemreport.php" target="_blank"><small><small>Report a Problem</small></a>
<table
style="width: 950px; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="text-align: center; vertical-align: top;"><div style="position:relative; top: -640px; left:300px;"><?php echo $toplinks; ?></div></td>
</tr>
</tbody>
</table>
</p></div> </div></div></div></body></html>