Switch othe function to PDO

Only 3 functions left without PDO (one easy and 2 not)