Andreas Konstantakos Andreas Konstantakos - 6 months ago 15x
PHP Question

Response method doesnt working properly in php script

I make a project in android studio for login/register.
I use volley library and a php script that connects my java code with my database.The POST method working perfectly and i can insert information in my database.But i get nothing on response.Seems there is an error in my php script.
Here is the php script:

$con = mysqli_connect("", "a3288368_user", "abcd1234", "a3288368_data");

$name = $_POST["name"];
$age = $_POST["age"];
$username = $_POST["username"];
$password = $_POST["password"];
$statement = mysqli_prepare($con, "INSERT INTO user (name, age, username, password) VALUES (?, ?, ?, ?)");
mysqli_stmt_bind_param($statement, "siss", $name, $age, $username, $password);

$response = array();
$response["success"] = true;

echo json_encode($response);

Any ideas what is going wrong?




You can't echo json string.