Please help ( I'm Desperate)

wxdqz

New Member
Hi
I would like to search 2 tables in mysql using only 1 input box in php, at the moment I have 2 input boxes one for the Town search and one for the County searh, I would like 1 input box that would search the 2 tables.

Here is my PHP Code:


<body>

<?php

mysql_connect (localhost, pw, pw);

mysql_select_db (test);

if ($ifa_town == "")
{$ifa_town = '%';}

if ($ifa_county == "")
{$ifa_county = '%';}

$result = mysql_query ("SELECT * FROM findifa
WHERE ifa_name LIKE '$ifa_name%'
AND ifa_business LIKE '$ifa_business%'
AND ifa_town LIKE '$ifa_town%'
AND ifa_county LIKE '$ifa_county%'
AND ifa_tel LIKE '$ifa_tel%'
AND ifa_fax LIKE '$ifa_fax%'
");

if ($row = mysql_fetch_array($result)) {

do {
print $row["ifa_name"];
print (" ");
print $row["ifa_business"];
print (" ");
print $row["ifa_town"];
print (" ");
print $row["ifa_county"];
print (" ");
print $row["ifa_tel"];
print (" ");
print $row["ifa_fax"];
print ("<p>");
} while($row = mysql_fetch_array($result));

} else {print "Sorry, no records were found!";}

?>

</body>
 
Back
Top