mysql query question

I want insert "This is a apple, it is a fruit" to query the database. and only match the words 'apple' and 'fruit' not 'fruits' from the database and return '1 fruit apple red 10'.How to modify the query code?Thanks.database name 'food' fields as below:\[code\]id name1 name2 name3 name4 type1 fruit apple red 10 article2 fruit banana yellow 12 article3 drink beer yellow 6 article4 fruits apple yellow 16 booksmysql_connect("localhost", "root", "root") or die(mysql_error());mysql_select_db("article") or die(mysql_error());... ...echo $match . "r"; // $match= This is a apple, it is a fruit$query = mysql_query("SELECT * FROM food WHERE name1, name2 like '%$match%' ");$row=mysql_fetch_array($query);echo $row['id ']. "r" .$row['name1']. "r".$row['name2']. "r".$row['name3']. "r".$row['name4']. "n";\[/code\]
 
Back
Top