in reply to place holder error

Most likely, somewhere in your large and unreadable SQL, you have :0, potentially because you're interpolating some variable, maybe $adt_h_date into your SQL. Don't interpolate your date field but pass it in as a placeholder as well.