when i register than show blank page i wanna that show some output

<?php

if(isset($_POST['submit'])) {

$servername = "localhost"; $username = "root"; $password = ""; $dbname = "facebook";

// Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }

$fname=$_POST['uername']; $email =$_POST['email']; $pass=$_POST['password']; $cpass=$_POST['cpassword'];

$sql = "INSERT INTO `register`(`id`, `fname`, `sname`, `email_mobile`, `pass`) VALUES (null,'".$username."','".$email."','".$pass."','".$cpass."')";

if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "
" . $conn->error; }

$conn->close();

} elseif(isset($_POST['login'])) {

$servername = "localhost"; $username = "root"; $password = ""; $dbname = "facebook";

// Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }

$email = $_POST['email']; $pass = $_POST['pass'];

$sql = "SELECT * FROM `register` WHERE email='".$email."'AND pass = '".$pass."'"; $result = $conn->query($sql);

if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { //echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "
"; header("Location:data.php");

} } else { echo "0 results"; } $conn->close();

} ?>

Comments 3