glinky Posted September 2, 2009 Share Posted September 2, 2009 Hello, I´m making a script to search a database for a certain word and I´m using this query: $query = "SELECT * FROM contents WHERE text LIKE '%$searchDb%'"; It works fine but I would like to know if there is a way to find out the exact word it founds. For example if I search for "econom" it will return a text where exists the word "economy". Is there a way to know the word it based its search on? In this case a way to return the value "economy"? Is there a way of doing this? (sorry if this is a stupid question!) Help apreciated Thanks Link to comment https://forums.phpfreaks.com/topic/172776-query-return-exacto-word-found-in-db/ Share on other sites More sharing options...
Fruct0se Posted September 2, 2009 Share Posted September 2, 2009 if your just trying to get the results from the query where it matched then add the following lines after your query: $result=mysql_query($query); while ($row = mysql_fetch_row ($result)) { extract($row); echo "$text<br/>"; } Link to comment https://forums.phpfreaks.com/topic/172776-query-return-exacto-word-found-in-db/#findComment-910662 Share on other sites More sharing options...
fenway Posted September 7, 2009 Share Posted September 7, 2009 I don't really understand the question. Link to comment https://forums.phpfreaks.com/topic/172776-query-return-exacto-word-found-in-db/#findComment-914143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.