paulmo Posted December 24, 2009 Share Posted December 24, 2009 jsg you helped me with the user text form string variable which becomes $word, but it is only getting searched on last word in string against db, wheras I need any and [mostly] every word in string searched, in any order. for example "hot water" gets match because 'water' is in db table, but 'water hot' is returning no results. thank you!! $message = mysql_real_escape_string($message); $message = strip_tags($message); $name = trim($name); $name = strip_tags($name); $name = mysql_real_escape_string($name); $pre_filter=trim($message);$get_search=explode(" ",$pre_filter);$post_message = stripslashes($post_message);$name = $_POST['name'];$post_name = ucfirst($name);echo "Message: {$post_message}<p>";$where = '';$common = array('they', 'this', 'that', 'them', 'those', 'your',);foreach ($get_search as $word){$word = trim($word); Link to comment Share on other sites More sharing options...
justsomeguy Posted December 24, 2009 Share Posted December 24, 2009 I don't see the problem in that code, you're overwriting the $name variable after processing it though. Link to comment Share on other sites More sharing options...
paulmo Posted December 24, 2009 Author Share Posted December 24, 2009 thanks jsg...it's got to be my query...someone suggested a join. can you get me started please? one table; $word gets matched to column 'good'; if match, $word gets matched to column 'keyword'; match on 'keyword' echoes same row in 'echo_good' column to user (keyword id = echo_good id).if no match on 'good', match against column 'bad' etc.if no match on good or bad but match on 'keyword', echo message to user to elaborate on keyword match. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 28, 2009 Share Posted December 28, 2009 Show the complete code you're working with, the above code plus whatever else is in the loop and after the loop. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.