PDO introduction

Added PDO to almost all the function, only 4 left.