hello im doing an app where it manages house owners and tenants connection, im trying to print an apartment id for specific apartment but keeps getting error
this my code:
$user = $_SESSION['username'];
$query="select ID from apartment WHERE owner= '$user'";
$res = mysqli_query($conn,$query);
print_r($res)
im getting this error
"mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 0 [type] => 0 )"
CodePudding user response:
You're trying to print the query itself, not the result.
Add something like:
$user = $_SESSION['username'];
$query="select ID from apartment WHERE owner= '$user'";
$res = mysqli_query($conn,$query);
$res = mysqli_fetch_assoc($res); // this line
print_r($res)