Ok I am having another problem. I am trying to check to see if a record has been found, if not I want it to display a message that says no record found. Here is the code I have so far. If not record is found then it displays a blank page. Instead of the message. Thanks in advance for any help.
Code is below:
//Connect
$db = mysql_connect($dbhost,$dbuser,$dbpass);
@mysql_select_db( "$dbname",$db) or die( "Unable to select database");
//error message (not found message)
$XX = "No Record Found";
//Query
$query = mysql_query("SELECT * FROM $usertable WHERE companyname LIKE '$companyname%' ");
while ($myrow = mysql_fetch_array($query))
{
print ("\n<b>Company Name:</b> ");
if ($myrow[web]) {
print ("\n<a href=\"http://");
echo "$myrow[web]";
print ("\" target=_blank>");
}
echo "$myrow[companyname]";
print ("</a>");
print ("\n<b> Name:</b> ");
echo "$myrow[firstname] ";
echo "$myrow[lastname]<BR>";
if (!$myrow[indkey]) {
// throw message if no record
print ("$XX");
exit;
}
}
end