Code:
<?php
$conn = mysql_connect('localhost', 'mysql_user', 'mysql_password') or die(mysql_error());
mysql_select_db("mysql_user",$conn) or die(mysql_error());
$query = "SELECT * FROM tablename WHERE concat(field1,field2,field3) like \"%search%\" and concat(field1,field2,field3) like\"%term%\"";
$res = mysql_query($query);
while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
echo "$row[field4]<br><br>";
}
?>
Not sure what you mean when you say:
Basically, I want to setup the recorset so that it catches the word or words from the
url and looks within the five fields to see if any of them "contain" the search word.
but the above script will search 3 fields in a table so that if the two terms are both found in the three fields selected of a table then it will return the result. The last line just prints off an arbitrary field from the row where the two terms were both found.
Bookmarks