title: Catchable fatal error: Object of class PDOStatement could not be converted to string in line 114
body: <p>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/mandje.php on line 114.
  This is the code I'm using:</p>
  
  <pre><code> foreach($_SESSION["cart"] as $id =&gt; $value){
  
          $query = $db-&gt;query('SELECT * FROM Producten WHERE ProductID ="'.$id.'" ');
          $query-&gt;execute();
  
          while($row = $query-&gt;fetch(PDO::FETCH_ASSOC)){
              $price = $row['Prijs'];
              $ProductID = $row['ProductID'];
              }
          $sql="INSERT INTO Bestellingsdetail( Bestelnummer, ProductID, Aantal, Prijs)
          VALUES ($max,$ProductID,$value,$price)";      //&lt;---- line 114
          $count = $db-&gt;execute($sql);
  </code></pre>
  
  <p>I don't really get what's going wrong here. Any help would be much appreciated :)</p>