You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND pro_publicar = 'S' ORDER BY RAND() LIMIT 0,15' at line 1SELECT pro_modelo FROM produto WHERE pro_id_marca = AND pro_publicar = 'S' ORDER BY RAND() LIMIT 0,15