Ошибка в SQL
SELECT i.id,i.pid,i.module_id,i.title,i.l_width,i.l_height,i.b_width,i.b_height,i.note,p.fotogallery
FROM images i
LEFT JOIN pages p
ON p.id = i.pid
WHERE (i.pid= AND i.module_id=1)
ORDER by i.id
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 i.module_id=1)
ORDER by i.id' at line 5