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!!! Link to comment https://forums.phpfreaks.com/topic/717-blike-function-in-select-statementb/ 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 Link to comment https://forums.phpfreaks.com/topic/717-blike-function-in-select-statementb/#findComment-2381 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); Link to comment https://forums.phpfreaks.com/topic/717-blike-function-in-select-statementb/#findComment-2382 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.