shenniko Posted February 10, 2006 Share Posted February 10, 2006 Hi Guys need a little help,Pretty new to MySQL and PHP, as i started learing ASP thought Access DB's...Ive created a sort of search function for my members section, so you can search by Username..How do you create a "LIKE" statement?E.g say i enter Da into the search box, it will bring Everything back with "Da" in the database?All i need is the WHERE tblCharacter.Character LIKE '$Character'";Or whatever the code is.thanks in advanceshenn Quote Link to comment https://forums.phpfreaks.com/topic/3376-search-db/ Share on other sites More sharing options...
mshallop Posted February 10, 2006 Share Posted February 10, 2006 [!--quoteo(post=344455:date=Feb 10 2006, 05:31 AM:name=shenniko)--][div class=\'quotetop\']QUOTE(shenniko @ Feb 10 2006, 05:31 AM) [snapback]344455[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hi Guys need a little help,Pretty new to MySQL and PHP, as i started learing ASP thought Access DB's...Ive created a sort of search function for my members section, so you can search by Username..How do you create a "LIKE" statement?E.g say i enter Da into the search box, it will bring Everything back with "Da" in the database?All i need is the WHERE tblCharacter.Character LIKE '$Character'";Or whatever the code is.thanks in advanceshenn[/quote]WHERE tblCharacter.Character LIKE '%$Character%'";if $Character == "da" and this is being submitted from somescript.php...--Mike Quote Link to comment https://forums.phpfreaks.com/topic/3376-search-db/#findComment-11543 Share on other sites More sharing options...
fenway Posted February 10, 2006 Share Posted February 10, 2006 If you are doing this often, you many want to consider using a FULLTEXT index. Quote Link to comment https://forums.phpfreaks.com/topic/3376-search-db/#findComment-11554 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.