I have done a search page based on a specific column name, but in some
columns there is no results to be returned..

What I would like to do is display an error message stating that there is no
results .. something like "Sorry your search returned Zero Rows"
Here is my code:

$connection = @mysql_connect($databaseserver, $databaseuser, $databasepass)
or die("Can't connect to DB");
$db = @mysql_select_db($databasename, $connection) or die("could not select
$sql = "SELECT id, FirstName, LastName FROM Canidate WHERE Industry =
$result = @mysql_query($sql, $connection) or die("could not execute query");

$contact_list = "<ul>";
while ($row = mysql_fetch_array($result)) {

$id = $row["id"];
$FirstName = $row["FirstName"];
$LastName = $row["LastName"];
$contact_list .="<li><a href=\"show_can.php?id=$id\">$LastName,
$contact_list .="</ul>";
$msg = "<font face=\"arial\"><p align=\"center\">Sorry, Your Search Results
Returned Zero Records</p></font>";

<title>Your Search Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<p align="center"><font face="Arial, Helvetica, sans-serif"><u>Your Search
  for <b> &quot;
  <? echo "$Industry"; ?>
  &quot; </b></u></font></p>
========================== this is the code block that is stumping me
if ($Industry != "") {
echo "$msg";

} else {
echo "$contact_list";
<p align="center"><a href="admin.htm"><font face="Arial, Helvetica,
  Back to Main Menu</font></a></P>


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to