Witam oto mój problem. chce żeby wyświetlały się wszystkie appki które user sciągnie. Wyskakuje mi taki błąd
Recoverable fatal error: Object of class mysqli_result could not be converted to string in E:\XAMPP\htdocs\GitMe\System\Desktop\index.php on line 32
oto mój kod:
<?php
session_start();
$db = new mysqli('localhost', 'root', '', 'gitme');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
<?php echo $_SESSION['username']; ?> | Desktop
</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="systemDesktop" id="systemAppDesktop">
<?php
$host = "localhost";
$db_user = "root";
$db_password = "";
$db_name = "gitme";
$mysqli = new mysqli($host, $db_user, $db_password, $db_name);
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$pID = $_SESSION["id"];
$query ="SELECT * FROM app_downloaded WHERE owner_id = '".$pID."'";
if ($result = $mysqli->query($query)) {
$numRow = $result->num_rows;
if($numRow == ""){
echo '';
}
else{
while ($row = $result->fetch_assoc()) {
$applink = $row['linkto'];
$appicon = $row['icon'];
echo '<a href="'.$applink.'"><div class=":hookapp app"><img src="'.$appicon.'" class="app-icon"><br><span class="appname">'.$row["name"].'</span></div></a>';
}
// end of while
}
// <div class="widget-element widget-equipment-element widget-item dis-inl-blo"><h5>", $row["itemName"], "</h5><br><img class='widget-item-image' src='".$row["imageLink"]."'><br><button type='submit' class='btn btn-success'>Odbierz</button></div>"
$result->free();
}
?>
</div>
<div class="hiddenSystemInfos">
<?php
$connect = new mysqli($host, $db_user, $db_password, $db_name);
$tapetaSQL = "SELECT DesktopImg FROM users WHERE username == '".$_SESSION['username']."'";
$tapetaResult = $_SESSION['dimage'];
if($tapetaResult == "S"){
echo '<input class="desktop:image" type="hidden" id="desktopImage" value="desktop.png">';
}
else{
echo '<input class="desktop:image" type="hidden" id="desktopImage" value="'.$tapetaResult.'">';
}
$connect->close();
?>
</div>
<script>
function desktopSet(){
let dataDesktopImage = document.querySelector('#desktopImage').value
const desktopDIV = document.querySelector('#systemAppDesktop')
desktopDIV.style.background = `url(${dataDesktopImage})`
setTimeout(desktopSet, 1)
}
</script>
</body>
</html>
Co Zrobić panie kierwoniku?