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 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%'; 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 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.. 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
Archived
This topic is now archived and is closed to further replies.