|
Hi - i have a problem adding a search engine to my php site.
All blankspaces in my database (mySQL driven) have been replaced by (this is something that cannot be changed) so dan brown appears dan brown.
Therefore when you search for dan brown no results are returned but when you search for dan brown the required results are returned.
Below is the code that i am using on my site:
form code
<td><form action="../search/results.php?name=name">
<br><input name="name" bgcolor="#FFFFFF" class="film_box" size="13" />
<input name="Submit" type="submit" value="GO"/>
</form>
Results return page code
<?php
$query = "SELECT * FROM IDX Where Name LIKE '%{$_GET['name']}%' "; #19
$result = mysql_query($query)
or die ("Couldn't execute query."); #21
/* Display text before form */
echo "Your search request has returned the following names.\n";
/* Create form containing selection list */
echo "<form action='actor.php' method='get'>\n"; #34
echo "<table>";
$counter=1; #36
while ($row = mysql_fetch_array($result)) #37
{
extract($row); #39
echo "<tr><td valign='top' width='620'>\n";
#42
echo "<b><li><a href='actor.php?actor_id={$row['NameID']}&name={$row['Name']}'>$Name</a></li></b>"; #47
echo "</td>";
#49
echo "</tr>";
$counter++; #51
}
echo "</table>";
echo "
</form>\n";
The above code has been tested and it works - but only when you search for one word!
I am pretty sure that i need to put some code in the results return page that replaces all ' ' with ' ' - but i would not know where to start! Please iunderstand that i am a relatively novice coder.
Any assistance that you can offer will be greatly appreciate
|