php mysqli_result zu string konvertieren?
Hey,
Ich mache gerade eine Website mit PHP und will von MySQL etwas SELECTen und dann in einem $_SESSION cookie reintun.
Das sieht bis jetzt so aus:
$abfrage = "SELECT account_type FROM users WHERE id = $id";
$ergebnis = mysqli_query($link, $abfrage);
$_SESSION["accounttype"] = $ergebnis;
<label>Account Type: </label>
<h4><?php echo $_SESSION["accounttype"] ?></h4>
Jetzt wird aber nur ein Error angezeigt, dass der Output kein String ist:
Fatal error: Uncaught Error: Object of class mysqli_result could not be converted to string in C:\xampp\htdocs\welcome.php:47 Stack trace: #0 {main} thrown in C:\xampp\htdocs\welcome.php on line 47
Nun ist meine Frage: Wie kann ich mysqli_result zu einem String konvertieren?
Computer,
programmieren,
MySQL,
PHP