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 6 SELECT * FROM wpa_online_new
INNER JOIN wpa_online_2 on idc2=co_tipo2
INNER JOIN wpa_online_1 on idc1=co_tipo
INNER JOIN wpa_partner_fad on pf_co=idco and pf_prt=7
WHERE idc2=
ORDER BY RAND()
LIMIT 4 ;