I have a MySQL database with char fields. I want to do a lookup for a certain word. my first attempt was this
$sql="SELECT * FROM $table_name WHERE substr_count(name, \"$searchname\")>0";
$result=@mysql_query($sql,$connection);
#name is the mysql field name and $searchname is the variable from the search form.
Is there a way to make this work or another way to do this in a mysql query. Right now I am doing it with an array after the query but my database has about 200,000 names in it so every search takes about 20 seconds. I have seen this same search of a mysql database take only a few seconds.
$sql="SELECT * FROM $table_name WHERE substr_count(name, \"$searchname\")>0";
$result=@mysql_query($sql,$connection);
#name is the mysql field name and $searchname is the variable from the search form.
Is there a way to make this work or another way to do this in a mysql query. Right now I am doing it with an array after the query but my database has about 200,000 names in it so every search takes about 20 seconds. I have seen this same search of a mysql database take only a few seconds.