1064 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 gi.gallery_id = gid.gallery_id' at line 3
in:
[select * from gallery gi, gallery_description gid where gi.gallery_parent_id = and gi.gallery_id = gid.gallery_id]