hecheng Posted July 15, 2003 Share Posted July 15, 2003 the following is my mysql_query statement $result=mysql_query(\"select * from elementary where Location like \'%\".$_POST[\'textfield\'].\"%\'\", $mylink); If I input inToronto for my search string, the result does not output the records that have Toronto in them. could anybody explain how i can fix the problem? Thank you!!! Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 15, 2003 Share Posted July 15, 2003 i\'ve had difficulties including $_POST variables in mysql queries before. see if this helps: $search = $_POST[\'textfield\']; $result = mysql_query("SELECT * FROM elementary WHERE location LIKE \'%$search%\'", $mylink); cheers Quote Link to comment Share on other sites More sharing options...
effigy Posted July 15, 2003 Share Posted July 15, 2003 you can also enclose the POST in braces like so: $result = mysql_query(\\\"SELECT * FROM elementary WHERE location LIKE \'%{$_POST[\'textfield\']}%\'\\\", $mylink); 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.