SELECT i.id as id, i.image, i.link as link, it.name as name, it.text as text FROM images i INNER JOIN images_text it ON i.id = it.image_id WHERE it.language_id=0 AND i.page_id = ORDER BY i.main, it.name
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 i.main, it.name' at line 9