i am new to this and i am stuck with this error
Undefined property: stdClass::$id in C:\xampp\htdocs\thesisApp\db\login.php on line 6
here is the code
<?php
$con = new mysqli("localhost", "root", "root", "thesisAppdb");
$data = json_decode(file_get_contents("php://input"));
$id = mysqli_real_escape_string($con, $data->id);
$username = mysqli_real_escape_string($con, $data->username);
$password = mysqli_real_escape_string($con, $data->password);
$query = ("SELECT id FROM teacherdata WHERE username= '$username' and
password= '$password' and id = '$id'");
$que = mysqli_query($con, $query);
$count = mysqli_num_rows($que);
if ($count == 1) {
echo 'correct';
} else {
echo 'wrong';
}
?>
hope to hear news from anyone.
$idis still an object? can you print$idfor debuggingvar_dump($data).var_dump(file_get_contents("php://input"))