Ejemplo n.º 1
0
 public function saveExistingUser(User $user)
 {
     // These values should be sanitized
     // I believe this is fixed
     $query = "UPDATE users SET email=:email, age=:age, bio=:bio, is_admin=:admin, full_name=:fullname, address=:address, postcode=:postcode, bank_acc_num=:bank_acc_num, is_doctor=:is_doctor WHERE id=:userid";
     $stmt = $this->pdo->prepare($query);
     $email = $user->getEmail();
     $age = $user->getAge();
     $bio = $user->getBio();
     $admin = $user->isAdmin();
     $fullname = $user->getFullname();
     $address = $user->getAddress();
     $postcode = $user->getPostcode();
     $bank_acc_num = $user->getBankAccNum();
     $is_doctor = $user->isDoctor();
     $userid = $user->getUserId();
     $stmt->bindParam(':email', $email);
     $stmt->bindParam(':age', $age);
     $stmt->bindParam(':bio', $bio);
     $stmt->bindParam(':admin', $admin);
     $stmt->bindParam(':fullname', $fullname);
     $stmt->bindParam(':address', $address);
     $stmt->bindParam(':postcode', $postcode);
     $stmt->bindparam(':bank_acc_num', $bank_acc_num);
     $stmt->bindParam(':is_doctor', $is_doctor);
     $stmt->bindParam(':userid', $userid);
     return $stmt->execute();
 }