There is a query to the MySQL database

SELECT id, short_story, xfields, title, category, alt_name FROM dle_post WHERE approve=1 AND title LIKE 'Работа' ORDER BY date DESC LIMIT 0,7

It is necessary that he displays all the lines with a match in the title of the text Work I do through the

 while ($row = mysql_fetch_array($res) ){ echo $row['title']; } 

In the answer is emptiness. If done through RLIKE, it displays 1 entry with a similar title title.

  • 2
    Now your like is absolutely equivalent to the usual strict equality. For there is no pattern denoting any characters ( % ), if you certainly want to search for part of the string. mysql.ru/docs/man/Pattern_matching.html - Mike

1 answer 1

Rewrite as:

 SELECT id, short_story, xfields, title, category, alt_name FROM dle_post WHERE approve=1 AND title LIKE '%Работа%' ORDER BY date DESC LIMIT 0,7 

if you want to have all the headers in which there is the word "work".

If you want to find titles that begin with the word "work" then you need to write a condition like AND title LIKE 'Работа%'

In SQL, when comparing by pattern, _ denotes any single character, and % means a certain number of characters (including zero characters). In MySQL, the default SQL templates are not case sensitive.