PHP Login Form Using PDO Prepared Statement


Below is a tutorial on how to create a login form using PDO prepared statement, we created an HTML form for the user to input login information, connect to the database with required_once, use try and catch to get the error, query the database with PDO prepared statement and use if statement for validation of login information.

********************* Start copying code from here ******************************
prepare("SELECT * FROM registration WHERE email = ? AND password = ?");
		$validation_query->execute([$email,$password]);
		if($validation_query->rowCount()>0){
			echo "Email exist";
		}else{
			echo "Email doesn't";
		}
	}catch(PDOException $e){
		echo $e->getMessage();
	}
}
?>




	
	
	Login Form


	
********************* Code Ends Here ******************************

Michal Isijola

I am an experienced IT expert with 10+ years of experience with a track record of success in creating apps that are both well-received and commercially viable. Skilled in working as a team and incorporating input into projects, a strong eye for detail, and tenacity to never quit on something until it is absolutely perfect. Innovative use of technology for excellent delivery of tasks, ability to complete projects efficiently, and satisfy customers with attractive, user-friendly applications. And also, the ability to oversee the development and dissemination of technology for external customers, vendors, and other clients to help improve and increase business.