I have maybe a really simple problem for you but it's making me crazy.
In my index.php I call my userHandler to retrieve data from MySQL in this first line of code but whatever I do the $result stays null.
When debugging, I can clearly see that the MySQL returns one row and its not null.
$result = $userHandler->getUserByPhone($phoneNumber);
if ($result != NULL) {
}
Here is the method that returns result:
public function getUserByPhone($Phone) {
$stmt = $this->conn->prepare("SELECT user.* FROM user");
$stmt->execute();
$result = $stmt->get_result();
$num_of_rows = $result->num_rows;
$stmt->store_result();
$stmt->close();
return $result;
}
And here is the screenshot of function

Edit:
Ok i tought that after closing the statement the data would be lost. and thats true if i still want to return the data of the statement. but before closing i stored the data in a variable. and then close it. I checked in debug after closing the variable still has the data.

Then i thought maybe the variable will be set null too (after all im a noob in php i can think none sense :D ) so i only returned True. But its still null in receiving end.

$resultis not null inside the function, there's no way ot could be null outside. There must be something else going on that you're not showing.