added class mypdo and fixed some sql errors