gtal3x Posted December 1, 2007 Share Posted December 1, 2007 Hello i have a table with 3 colums: id (int), time (timestamp), cookie (text) The cookie colum is a memo wich contains many lines of text, what i wont to do is SELECT a colum WHERE cookie = somevalue here... i have got few lines of code to do that however it gives me an error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:... My Code: $select_cookie = "SELECT * FROM $site WHERE MATCH ('cookie') AGAINST ('login=someuser')"; $cookie_query = mysql_query($select_cookie); $cookie_exist = mysql_num_rows($cookie_query); Thanks in advance! Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 1, 2007 Share Posted December 1, 2007 <?php $select_cookie = "SELECT * FROM $site WHERE MATCH ('cookie') AGAINST ('login=someuser')"; $cookie_query = mysql_query($select_cookie) or die(mysql_error()); $cookie_exist = mysql_num_rows($cookie_query); ?> whats the error now? Quote Link to comment Share on other sites More sharing options...
gtal3x Posted December 1, 2007 Author Share Posted December 1, 2007 <?php $select_cookie = "SELECT * FROM $site WHERE MATCH ('cookie') AGAINST ('login=someuser')"; $cookie_query = mysql_query($select_cookie) or die(mysql_error()); $cookie_exist = mysql_num_rows($cookie_query); ?> whats the error now? 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 ''cookie') AGAINST ('login=someuser')' at line 1 Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 1, 2007 Share Posted December 1, 2007 Okay.. i don't use fulltext but i assume you are refering to cookie as a field not text.. if so it should be $select_cookie = "SELECT * FROM $site WHERE MATCH (`cookie`) AGAINST ('login=someuser')"; Quote Link to comment Share on other sites More sharing options...
gtal3x Posted December 1, 2007 Author Share Posted December 1, 2007 ok i did what you told me, but now it gives me a new error... Can't find FULLTEXT index matching the column list My code: $select_cookie = "SELECT * FROM $site WHERE MATCH (`cookie`) AGAINST ('%login=user;%')"; $cookie_query = mysql_query($select_cookie) or die(mysql_error()); $cookie_exist = mysql_num_rows($cookie_query); and yes user is in the field... any idea on that? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 1, 2007 Share Posted December 1, 2007 you don't have a FULLTEXT Index.. may i ask, is their a reason your not using LIKE ? ie SELECT * FROM $site WHERE `cookie` LIKE '%login=user;%'; Quote Link to comment Share on other sites More sharing options...
gtal3x Posted December 1, 2007 Author Share Posted December 1, 2007 thanx! 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.