Forum Moderators: coopster
Script here below
=========================================================
<?php
mysql_connect (localhost, "", "");
mysql_select_db (db_name);
if ($company == "")
{$company = '%';}
if ($id == "")
{$id = '%';}
$result = mysql_query ("SELECT * FROM find WHERE company = '$company%' AND id = '$id%'
");
if ($row = mysql_fetch_array($result)) {
do {
print $row["company"];
print (" ");
print $row["id"];
print ("<p>");
} while($row = mysql_fetch_array($result));
} else {print "Sorry, no records were found!";}
?>
$sql = "SELECT * FROM find WHERE company = '$company%' AND id = '$id%'";
echo $sql;
$result = mysql_query ($sql);
Second, test the query in phpMyAdmin (or whatever frontend you use with MySQL) and see if you get what you expect there.
'company_location LIKE '%$location%' AND company_type LIKE '%$type%' Is the company field the name of the companies, or the location? Is the id field the type of company they are, or the auto_id for the company?
Have you echoed out your query to see if it makes sense? Have you run it in phpMyAdmin to see if you get what you expect?