I have made my database results able to be shown or hidden from my site by setting a 'visible' value to '0' for hidden or '1' for show. I have added WHERE visible = '1' to my queries to show only 'visible' results. When I try adding this to my search query it still shows results with a value of '0'.
"SELECT * FROM games WHERE title like '%$search%' OR description like '%$search%' OR category like '%$search%' OR author like '%$search%' && visible = '1'"
Hi, just tried changing && to AND but still no luck, the query still works fine, no errors but still shows visible when set to 0 when I ask it to only show visible when set to 1...???
SELECT * FROM `games`
WHERE `title` LIKE '%$search%'
OR `description` LIKE '%$search%'
OR `category` LIKE '%$search%'
OR `author` LIKE '%$search%'
AND `visible` = 1;
I do not know which field you have, but if your field is INTEGER, the value has to be INTEGER too.
Do not use quotes.
SELECT
*
FROM
games
WHERE
(
title LIKE '%$search%'
OR description LIKE '%$search%'
OR category LIKE '%$search%'
OR author LIKE '%$search%'
)
AND visible = '1'"
title like '%$search%' OR description like '%$search%' OR category like '%$search%' OR author like '%$search%'
and just leave visible = '1' it works, it shows all results, but only the results that visible = '1' but I just cant get the search part if the query to work in this query??
I have used the visible = '1' now throughout my whole website, it just won't work in this query...