Fatal error: Uncaught Exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY rand() LIMIT 4' at line 1 query: SELECT I.id, I.slug, id_categoria, I.id_condominio, quartos, suites, vagas, banheiros, situacao, descricao, exclusividade, tag_personalizada, titulo, disponibilidade, mostrar_valor, cod_imovel, area_util, area_total, tipo_medida, valor_locacao, valor_venda,CA.categoria, E.cidade, E.bairro FROM imoveis I LEFT JOIN imoveis_categorias CA on CA.id = I.id_categoria LEFT JOIN imoveis_enderecos E on E.id_imovel = I.id WHERE I.status = 'A' AND I.id != 72284583 AND I.id_categoria = ORDER BY rand() LIMIT 4 in /home/trovu/www/vendor/thingengineer/mysqli-database-class/MysqliDb.php:2013 Stack trace: #0 /home/trovu/www/vendor/thingengineer/mysqli-database-class/MysqliDb.php(1601): MysqliDb->_prepareQuery() #1 /home/trovu/www/vendor/thingengineer/mysqli-database-class/MysqliDb.php(751): MysqliDb->_buildQuery(4) #2 /home/tr in /home/trovu/www/vendor/thingengineer/mysqli-database-class/MysqliDb.php on line 2013