Boo-urns Posted April 22, 2008 Share Posted April 22, 2008 I'm trying to get a search where the user enters in anything say "hat" I want to search a subject that contains "hat" but not "what" I can get the results just fine however I'm still pulling in the "what" <?php $message_query = "SELECT * FROM messages WHERE title LIKE '$title' AND viewable='Y'"; ?> I've also tried using \_ but am unsure on the proper usage as i'm trying to just find a string that finds that exact word. Thanks Corey Link to comment https://forums.phpfreaks.com/topic/102288-solved-mysql-like-search/ Share on other sites More sharing options...
rameshfaj Posted April 22, 2008 Share Posted April 22, 2008 if u want to have the word hat anywhere in the middle then try this: ...where value like'%hat%'.. and if u want the word to be starting one then try: ........where value like 'hat%'... and so on.Only u have to do is to try various combinations of the value and the percentage sign. Link to comment https://forums.phpfreaks.com/topic/102288-solved-mysql-like-search/#findComment-523761 Share on other sites More sharing options...
xProteuSx Posted April 22, 2008 Share Posted April 22, 2008 The '%' symbol is the wildcard in this case ... Link to comment https://forums.phpfreaks.com/topic/102288-solved-mysql-like-search/#findComment-523764 Share on other sites More sharing options...
Boo-urns Posted April 22, 2008 Author Share Posted April 22, 2008 Thanks! %$title works perfectly! =D Link to comment https://forums.phpfreaks.com/topic/102288-solved-mysql-like-search/#findComment-523768 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.