paulmo Posted December 20, 2009 Share Posted December 20, 2009 this is a series of queries, meant to echo 'echo_good' or 'echo_bad' column rows, but it's echoing 'keyword' row match instead. help please and thanks in advance. $sql = "SELECT * FROM rcenter WHERE MATCH good AGAINST ('%$word%')"; $result = mysql_query($sql) or die (mysql_error ()); $n=0; while($row = mysql_fetch_assoc($result)) { $n++; $sql = "SELECT * FROM rcenter WHERE MATCH keyword AGAINST ('%$word')"; $result = mysql_query($sql) or die (mysql_error ()); $sql = "SELECT * FROM rcenter WHERE keyword.id = echo_good.id AND (keyword.id LIKE '%$word%')"; $result = mysql_query($sql) or die (mysql_error ()); while($row = mysql_fetch_assoc($result)) { $n++; nl2br(stripslashes($row['echo_good'])); echo "<br>"; } } $anymatches=mysql_num_rows($result); if ($anymatches == 0) { $sql = "SELECT * FROM rcenter WHERE MATCH bad AGAINST ('%$word%')"; //etc... Link to comment https://forums.phpfreaks.com/topic/185736-phpmysql-code-help-please/ Share on other sites More sharing options...
Buddski Posted December 20, 2009 Share Posted December 20, 2009 What is this $sql = "SELECT * FROM rcenter WHERE MATCH keyword AGAINST ('%$word')"; $result = mysql_query($sql) or die (mysql_error ()); supposed to be doing.. Straight after you call it you are assigning $result to a whole new mysql_query.. Link to comment https://forums.phpfreaks.com/topic/185736-phpmysql-code-help-please/#findComment-980741 Share on other sites More sharing options...
paulmo Posted December 20, 2009 Author Share Posted December 20, 2009 thanks. i've never done a series query. can you help me out? Link to comment https://forums.phpfreaks.com/topic/185736-phpmysql-code-help-please/#findComment-980743 Share on other sites More sharing options...
Buddski Posted December 20, 2009 Share Posted December 20, 2009 Can you tell us what EXACTLY you are trying to achieve from theses queries.. The more detail you can give the better.. Link to comment https://forums.phpfreaks.com/topic/185736-phpmysql-code-help-please/#findComment-980744 Share on other sites More sharing options...
paulmo Posted December 20, 2009 Author Share Posted December 20, 2009 sure, thanks: user text form string ($%word%) gets matched against 'good', if match, string gets matched against 'keyword', if match, echo same row in 'echo_good' to user (keyword column row id = echo_good row id). same process for match on bad (except echo echo_bad). if no match against either good or bad, but match on keyword, echo message to user "please elaborate on (keyword)" Link to comment https://forums.phpfreaks.com/topic/185736-phpmysql-code-help-please/#findComment-980919 Share on other sites More sharing options...
paulmo Posted December 22, 2009 Author Share Posted December 22, 2009 anyone take a shot at this please? Link to comment https://forums.phpfreaks.com/topic/185736-phpmysql-code-help-please/#findComment-981937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.