I\'m trying to add some data to my database, but I\'m getting the error Catchable fatal error: Object of class PDOStatement could not be converted to string in /var/www/mand
foreach($_SESSION["cart"] as $id => $value)
{
$query = $db->query('SELECT * FROM Producten WHERE ProductID ="'.$id.'" ');
$query->execute();
while($row = $query->fetch(PDO::FETCH_ASSOC))
{
$price = $row['Prijs'];
$ProductID = $row['ProductID'];
}
$array = array( $max, $ProductID, $value, $price );
$sql->prepare
("
INSERT INTO Bestellingsdetail (Bestelnummer, ProductID, Aantal, Prijs)
VALUES (?, ?, ?, ?)
")
$sql->execute($array);
}