Hi I have problem in my DB Query.
$q = $this->db->query("SELECT * FROM (`knihy`)
WHERE `stav` = 1
AND (Autor1 LIKE '$vyraz'
OR Autor2 LIKE '$vyraz'
OR Autor3 LIKE '$vyraz'
OR Autor4 LIKE '$vyraz')
ORDER BY `id` desc LIMIT $limit OFFSET $offset ");
The problem is that, when I am searching for example for “lorem” and I have in my table for example in row Autor1 content: “lorem ipsum” nothing will be found. But if I am searching for lorem ipsum there will be found those one field. Where is problem please?
You’re not using the right syntax for LIKE:
Should be:
Without the wildcards, you’re just doing an exact match.