Result: Blank Page (Php)

Advertisement

Hello guys, I'm a beginner and I started to learn php. I followed tutorials and learned something about how to fix errors as long as errors are declared / displayed. But I have this problem in my code where it does not show my site, it simply shows a blank page. My code is intended to check in db if the email already exists. Help me please.

 error_reporting(0); session_start(); include('_includes/config.php'); include('_includes/db.php'); function isUnique($email){ $query = "SELECT * FROM users where email ='$email'"; global $db; $result = $db->$query($query); if($result->num_rows >0){ return false; } else return true; } if(isset($_POST['register'])){ $_SESSION['uname'] = $_POST['uname']; $_SESSION['fname'] = $_POST['fname']; $_SESSION['lname'] = $_POST['lname']; $_SESSION['email'] = $_POST['email']; $_SESSION['address'] = $_POST['address']; $_SESSION['city'] = $_POST['city']; $_SESSION['postal'] = $_POST['postal']; $_SESSION['password'] = $_POST['password']; $_SESSION['con-pass'] = $_POST['con-pass']; } if(isset($_POST['uname']) && strlen($_POST['uname'])< 3){ header("Location:register.php?err=" . urlencode("The username must be at least 3 characters long")); exit(); } else if($_POST['con-pass'] != $_POST['con-pass']){ header("Location:register.php?err=" . urlencode("Password and Confirm Password do not match!")); exit(); } else if($_POST['password'] && strlen($_POST['password']) < 5){ header("Location:register.php?err=" . urlencode("The Password should be atleast 5 characters")); exit(); } else if(!isUnique($_POST['email'])){ header("Location:register.php?err=" . urlencode("Email is already in use, Please use another one!")); exit(); } 

The answer

delete error_reporting(0);
and make sure that you receive the expected fields / data using echo $_POST['con-pass']; etc.