I've been advised a couple of times on here to start changing my code to PDO and I've finally got round to doing it. My problem is that I'm having incredible difficulty with converting my existing login script. For the last few lines of the code below (after the line $result = $query->fetchAll(); ) I haven't been able to find any resources online that could help me re-write it: $username = $_POST['username']; $password = $_POST['password']; $db=getConnection(); $username = mysql_real_escape_string($username); $query = $db->prepare( "SELECT password, salt, 'employer' as user_type FROM JB_Employer WHERE Username = '$username' UNION SELECT password, salt, 'jobseeker' as user_type FROM JB_Jobseeker WHERE User_Name = '$username'"); $result = $query->fetchAll(); $qData = mysql_fetch_array($result, MYSQL_ASSOC); $hash = hash('sha256', $qData['salt'] . hash('sha256', $password) ); if (...