As described in the title, I would like to concatenate more than 2 columns in my SQL query like this:
$reqArticles = $db->prepare('SELECT id FROM articles WHERE CONCAT(title, content, author, location) LIKE "%'.$element.'%" ORDER BY id DESC');
This returns an empty array unlike when I enter only 2 parameters in "CONCAT".
PS: there is a similar question but its answer does not correspond to my need.
EDIT : the data looks like this :
`id = 1
fields = contents_fields
title = 'the football'
content =' Football is the most popular sport in the world '
author = 'Patrick'
location = 'French'`
And the output I'm waiting for must contain all the ids of the items in the "element" to be found
Re-Edit :
Important things I forgot: the location
field is often null.
I think that's where the error comes from because I did a small test by removing this field and leaving the other 3 the request works correctly. But to be confirmed.
so the data looks more like this:
`id = 1
fields = contents_fields
title = 'the football'
content =' Football is the most popular sport in the world '
author = 'Patrick'
location = 'French' or NULL`