Nato, Try something like this:
$num = mysql_numrows($result); if ($num == 0) { echo "There were no records found."; } else while ... -----Original Message----- From: Natividad Castro [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 11:01 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] redirect a page Hi to all, I have a search form where users can search for a specific record; up to now is working fine, but what I would like to do is: if the record is not found, redirect them to another page that says that record was not found. Can anybody tell me how to do this? I already tried using this statement if ( !mysql_fetch_array($result) ) { include file // this the page that I want to redirect them, but it doen't work } I would like to execute the first statement it's false: e.g if name doesn't match with anything in the table, redirect to another page else execute the whole query. $query = mysql_query("SELECT * from 150bk where trim(NAME) like '%" . $legal_name . "%'"); while($query_data = mysql_fetch_array($query)) { $id = trim($query_data[ID]); $name = trim($query_data[NAME]); $tracking_num = trim($query_data[TRACKING_NUMBER]); $census = trim($query_data[CENSUS_NUM]); $name_dba = trim($query_data[NAME_DBA]); } Any help, it's greatly appreciate Thanks Nato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php