So I have an if-else statement full of queries and it is the else part where there is an error and here it is:
else{
$nameuser = $_SESSION['username'];
$iduser = $connection->query("SELECT idCustomer FROM customer WHERE username='$nameuser'");
if(!$iduser){
die('Query failed!' . mysqli_error($connection));
}
if (isset($_POST['idd']) && $_POST['idd']!=""){
$idd = $_POST['idd'];
// echo $idd;
// $query ="INSERT INTO cart(idItem,idUser) VALUES('$idd','$iduser')";
$resulti = mysqli_query($connection , "INSERT INTO cart(idItem,idUser) VALUES('$idd','$iduser')");
if(!$resulti){
die('Query failed!' . mysqli_error($connection));
}
}
}
<input type='hidden' name='idd' id='idd' >
the exact error message: Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\wamp64\www\index.php on line 134
it is the last query's line
is it enough?