I'm new to PHP/SQL and very confused.
In my SQL database, I have the following values for a user:
In my PHP script, echoing these values gives me 0.
Query:
$query = "SELECT * FROM user WHERE email = '{$email}'";
$result = mysqli_query($con, $query);
$row = mysqli_fetch_array($result);
I specify the email linked to the above user in the database. I get the desired row as a result (user ID 13 and these null values). Still, the code gets inside this if statement:
if (!empty($row['first_name']) && !empty($row['last_name']) &&
!empty($row['age']) && !empty($row['picture_path'])) {
echo "inside";
}
Echoing the values themselves gave me 0 instead of null. Why? And how can I properly check for empty/null?
Thanks loads.