i am new to php... i got some error but cannot find it please help me.. error message....
Notice: Undefined variable: stmt.... Fatal error: Call to a member function bind_param() on null...
<?php
require "conn.php";
$username = $_POST["username"];
$password = $_POST["password"];
$statement = $conn->prepare("SELECT * FROM data WHERE username = ? AND password = ?");
$stmt->bind_param('ss' ,$username ,$password);
$stmt->execute();
$stmt->bind_result($username ,$password);
$stmt->store_result();
$response = array();
$response["success"] = false;
while($stmt->fetch($statement)){
$response["success"] = true;
$response["name"] = $name;
$response["age"] = $age;
$response["username"] = $username;
$response["password"] = $password;
}
echo json_encode($response);
?>