ignore broken attachments
replace silly fetch_all with traditional while/fetch_assoc way.
Check php 5.3 requirement.
remove debug output