phatuis Posted December 21, 2009 Share Posted December 21, 2009 Hello, I am looking for some help. What I am hoping to do, is say if in the search box, R is put in, then the script will run a command where it searches the database, where say in name, the first letter is R. However, if someone submits RY, then it would search NAME where it begins with RY. Is this possible? EDIT: Nevermind Quote Link to comment https://forums.phpfreaks.com/topic/185840-if-ry-is-given-select-all-where-it-starts-with-ry/ Share on other sites More sharing options...
PravinS Posted December 21, 2009 Share Posted December 21, 2009 Use SQL query like this. SELECT * FROM tbl_name WHERE key_col LIKE 'RY%'; Quote Link to comment https://forums.phpfreaks.com/topic/185840-if-ry-is-given-select-all-where-it-starts-with-ry/#findComment-981307 Share on other sites More sharing options...
phatuis Posted December 21, 2009 Author Share Posted December 21, 2009 Nevermind, I did WHERE name=, not WHERE name Like Quote Link to comment https://forums.phpfreaks.com/topic/185840-if-ry-is-given-select-all-where-it-starts-with-ry/#findComment-981313 Share on other sites More sharing options...
Deoctor Posted December 21, 2009 Share Posted December 21, 2009 have u tried to echo the value of $sql..and running it in the mysql to se if u are getting values correctly.. Quote Link to comment https://forums.phpfreaks.com/topic/185840-if-ry-is-given-select-all-where-it-starts-with-ry/#findComment-981317 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.