I have the following script where the user enters some data from the android phone in order to register.
<?php
include("connect.php");
include("functions.php");
if(logged_in())
{
    header("location:profile.php");
    exit();
}
$error = "";
$j = new stdClass();
$string = "";
if (isset($_POST['firstName']) && isset($_POST['lastName']) && isset($_POST['email']) && isset($_POST['password'])) {
    $firstName = $_POST['firstName'];
    $lastName = $_POST['lastName'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    //echo $firstName."<br/>".$lastName."<br/>".$email."<br/>".$password."<br/>".$passwordConfirm."<br/>".$image."<br/>".$imageSize."<br/>";
        //We need to encrypt our password.
        $password = md5($password);
        $insertQuery = "INSERT INTO users(firstName,lastName,email,password) VALUES('$firstName','$lastName','$email','$password')";
        $result = mysqli_query($con,$insertQuery);
        if(!$result){
                $j->status  = "Fail";
                $j->message = "No users in database";
                $string = json_encode($j);
                echo "No inserted data";
                //echo $string;
            }else{
                $j->status  = "success";
                $j->message = "Successfully registered";
                echo "Data inserted";
                $string = json_encode($j);
            }
    echo $string;
}
?>
Unfortunately nothing happens. I can't even generate JSON from the url itself. For example I enter the url's link
http://localhost/android_reg/
and get nothing back. Shouldn't I get
{
   "status":"fail",
   "status":"No users in database"
}
when there is not data in the database? Surely there is something wrong with my php code.
 
     
    