select *,filedetail.adftype as adftype,filedetail.id as id,datatype.shortdesc as class_short,datatype.longdesc as class_long,subtype.shortdesc as sub_short, subtype.longdesc as sub_long from filedetail left join datatype on datatype.id=filedetail.adftype left join switches on filedetail.id=switches.file left join subtype on subtype.id=switches.subtype left join limits on limits.file=filedetail.id left join ion on ion.file=filedetail.id where filedetail.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 '' at line 1