So I am trying to do a basic registration activity by using an android platform to retrieve values from a user and register the users credentials in a basic mySQL database. When I run my responseListener the register.php page is returning Server error 500 so I am led to believe my php script has a flaw.
register.php
<?php
error_reporting(-1); // reports all errors
ini_set("display_errors", "1"); // shows all errors
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/php-error.log");
try{
    $con = mysqli_connect("con","user","pass","db"); 
    if($_SERVER["REQUEST_METHOD"] == "POST") {
        $email = mysqli_real_escape_string($con,$_POST['email']);
        $username = mysqli_real_escape_string($con,$POST['username']);
        $name = mysqli_real_escape_string($con,$_POST['name']);
        $password = mysqli_real_escape_string($con,$_POST['password']);
        $response = array();
        $sql = "Select * from Registration where email = '$email' or username = '$username'";
        $result = mysqli_query($con, $sql);
        $user = mysqli_fetch_assoc($result);
        if(($user['username'] === $username) or ($user['email'] === $email)){
            $response["success"] = false;
            }
        else{
            $myhash = password_hash($password, PASSWORD_DEFAULT);
            $sql1 = "insert into Registration (email, username, name, password) values('$email', '$username', '$name', '$myhash')";
            $insert = mysqli_query($con, $sql1);
            $validation = mysqli_num_rows($insert);
            if($validation == 1){
                $response["success"]= true;
                }
            else{
                $response["success"]= false;
                }
                }
        echo json_encode($response);
        die($con);
        }
    }
    catch(error $e){
        $response = array();
        $reponse["success"] = false;
        $response["error"] = $e;
        echo json_encode($response);
        die($con);
        }
?>
Thanks for any help
 
     
    
– Diggy Dec 10 '18 at 00:49