NVG
NVG

Reputation: 3313

mysql search LIKE not working for long phrase

I have a MySQL table, type 'MyISAM', collation: 'latin1_swedish_ci'. Inside it, I have a column named 'content'.

Inside there, I have a row with the following content:

<p>The state will have a different advantage over most other states, with one of the largest populations in the nation to blablablabla. </p>

My query is this in phpMyAdmin and also in my PHP file:

SELECT *
FROM `pages`
WHERE `content` LIKE '%with one of the largest populations%'
ORDER BY `pages`.`title` ASC
LIMIT 0 , 30

0 rows are returned.

The weird thing is that if I edit the query to this:

SELECT *
FROM `pages`
WHERE `content` LIKE '%with one of the largest%'
ORDER BY `pages`.`title` ASC
LIMIT 0 , 30

Then , 1 rows are returned, and it works.

Is there any setting that might limit the search query to only a few words or only a few characters?

Upvotes: 2

Views: 290

Answers (1)

Rab
Rab

Reputation: 35572

Most probably there are any other whitespace character(s), otherwise, your query seems fine.

try this largest populations should also return 0 recs.

So replace, those characters from column before, searching.

You can find some help here

Upvotes: 1

Related Questions