This is a super simple script and looks correct, yet i get a blank screen. Does anything look incorrect?
<?php
include 'dbconfig.php';
include 'opendb.php';
$string = $_POST['search'];
$sql = "SELECT * FROM dealers WHERE zip LIKE '$string'";
$query = mysql_query($sql) or die(mysql_error());
$row_sql = mysql_fetch_assoc($query);
$total = mysql_num_rows($query);
if($total>0) {
while ($row_sql = mysql_fetch_assoc($query)) {//echo out the results
echo "Search Successfull. Blah Blah Blah";
}
} else
{
echo "No results to display";
}
?>
I have a simple database with dealer info such as business name, phone, web, city, state, zip. And i just wanted to be able to do a zip search to pull up the listing. No dice . Any ideas?
btw, when I perform a search with a zip that isn't in the db I get the "No Results to display". but when i search with zip that is in the db, the output is blank.