I don't use PHP.
I'll give it a try, but don't be surprised if I mess up the PHP code.
Code:
<?php
$search = $_POST["search"];
$words = explode( " ", $search ); // get array of words
$pattern = "";
for ( $w = 0; $w < count($words); ++$w )
{
$word = $wods[$w];
if ( $word != "" )
{
if ( $pattern != "" ) $pattern .= " AND "; // or use " OR " as discussed!
$pattern .= " ## LIKE '%" . $word . "%' ";
}
]
if ( $pattern == "" )
{
echo "You didn't give me anything to search for! I quit!";
exit( );
}
$pattern = "( " . $pattern . ") ";
$where = " WHERE " . str_replace( "##", "name", $pattern );
$where .= " OR " . str_replace( "##", "city", $pattern );
$where .= " OR " . str_replace( "##", "notes", $pattern );
$where .= " OR " . str_replace( "##", "moreinfo", $pattern );
$where .= " OR " . str_replace( "##", "amenities", $pattern );
$sql = "SELECT * FROM campground " . $where . " ORDER BY name";
// remove next line after it starts working
echo "DEBUG SQL: " . $sql . "<hr/>\n";
$result = mysql_query( $sql ) or die( mysql_error() );
,,, etc ,,,