Done this hundred of times before but this one is really throwing me out. As you can see the $value
is not converted to string; but the echo
before $result .=
outputs just fine as you can see in the log. The var_dump
also looks fine to me. I also tried (string)$value
. Can anyone shed some light ?
PHP CODE:
if ($result = $query->get_result()) {
while ($data = mysqli_fetch_assoc($result)) {
foreach ($data as $key => $value) {
var_dump($data);
echo $value;
$result .= "<div class='post modelVariant'>".$value."</div>";
}
}
mysqli_close($MySQLi);
} else {
mysqli_close($MySQLi);
}
CONSOLE LOG:
array(1) {
["model_variant"]=>
string(3) "9.0"
}
9.0
Recoverable fatal error: Object of class mysqli_result could not be converted to string