Jump to content

[SOLVED] mysql LIKE search??


Boo-urns

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.