Hello, its been a while since I use mysql and I breaking my head with this syntax:

SELECT * FROM `Botones` WHERE `aprove` = 1 
AND `descripcion` LIKE '%$search%' 
OR `nombre` LIKE '%$search%' 
ORDER BY `likes` DESC 
LIMIT 0,20

Its working great only problem is that it returns colums even if aprove is equal to 0, and I want it to return only colums that aprove = 1

aprove type is INT (1)
EDIT: nvm solve it by :

SELECT * FROM `Botones` WHERE `aprove` = 1 
    AND `descripcion` LIKE '%$search%' 
    OR `aprove` = 1 AND `nombre` LIKE '%$search%' 
    ORDER BY `likes` DESC 
    LIMIT 0,20

Silly me :P

Use brackets when you combine multiple AND OR conditions eg

WHERE `aprove` = 1 
AND (`descripcion` LIKE '%$search%' 
        OR `nombre` LIKE '%$search%')
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.