Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.