woodplease Posted February 20, 2012 Share Posted February 20, 2012 hey, i'm having an sql syntax error message display when trying to search my database. "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MATCH ('entry_text') AGAINST ('ancient')' at line 1" 'ancient' is the value being held in $search_string the code that i'm using is <?php if (isset($_POST['search_string'])){ $search_string = mysql_real_escape_string($_POST['search_string']); } ?> <form name="wikisearch" method="post" action="test.php"> <input type="text" name="search_string" size="40" /> <input type="submit" name="search" value="Search" /> </form> <?php if (isset($_POST['search_string'])){ $res = mysql_query("SELECT * FROM entry MATCH ('entry_text') AGAINST ('$search_string')")or die (mysql_error()); $ant = mysql_num_rows($res); echo "results: ".$ant; } ?> ANy ideas whats wrong Quote Link to comment Share on other sites More sharing options...
fenway Posted February 20, 2012 Share Posted February 20, 2012 Solved how? Quote Link to comment Share on other sites More sharing options...
sunfighter Posted February 20, 2012 Share Posted February 20, 2012 @fenway I've never seen MATCH --- AGAINST Shouldn't it be $res = mysql_query("SELECT * FROM entry WHERE `entry_text` = '$search_string'")or die (mysql_error());? Quote Link to comment Share on other sites More sharing options...
fenway Posted February 20, 2012 Share Posted February 20, 2012 MATCH...AGAINST exists -- check the refman. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.