A
Anonymous
Guest
Code:
// The form:
<form method="POST" action="">
Search Word: <input type="text" name="query">
<input type="SUBMIT" value="Search!">
</form>
<?
// PHP Search Script
$sql = mysql_query("SELECT topico,texto FROM yourtable WHERE topico LIKE %$query% OR texto LIKE %$query%") or die (mysql_error());
while(list($column1, $column2)=mysql_fetch_array($sql)){
echo "Result: $column1, $column2 <br />";
}
?>
i search for hello, and gives-me this error :
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '%hello% OR texto LIKE %hello%' at line 1