0

My database:

+-------+-------+
| test1 | test2 |
+-------+-------+
|   0   |   1   | 
+-------+-------+

Both columns are set to tinyint(1), not null, default 0

$value1 = $mysqli->query("SELECT test1 FROM test");
$value2 = $mysqli->query("SELECT test2 FROM test");

if ($value1 == false){
echo 'Value1 is false';
}

elseif ($value1 == true){
echo 'Value1 is true';
}

if ($value2 == false){
echo 'Value2 is false';
}

elseif ($value2 == true){
echo 'Value2 is true';
}

Output is: "Value1 is trueValue2 is true"

While I want to output "Value1 is false" and "Value2 is true"


I kind of new to PHP so maybe I did a stupid mistake, but I've checked other questions, still can't find an answer


Balázs
  • 15
  • 2
  • Use `var_dump( $value1, $value2 );` to get your answer. – MonkeyZeus Jun 26 '18 at 19:02
  • Did you read the manual for [query](http://php.net/manual/en/mysqli.query.php)? It returns a `false` or a [mysqli_result object](http://php.net/manual/en/class.mysqli-result.php). You have to get the values out of that object first before you can test against them – Machavity Jun 26 '18 at 19:02

0 Answers0