title: pdo mysql update not updating rows with no errors
body: <p>I have an array called "data":</p>
  
  <pre><code>    Array
      (
          [0] =&gt; Array
              (
                  [ID] =&gt; 75538
                  [stock] =&gt; In Stock
                  [Price] =&gt; 82.6900
              )
  
          [1] =&gt; Array
              (
                  [id] =&gt; 75536
                  [stock] =&gt; In Stock
                  [Price] =&gt; 72.0000
              )
              ............(cont...)
  </code></pre>
  
  <p>I am running an update query as follows:</p>
  
  <pre><code>    $conn-&gt;beginTransaction();
      $sql  = "UPDATE products SET stock_status = ?,price = ? WHERE id= ?";
  
      try {
      $stmt = $conn-&gt;prepare($sql);
      foreach ($data as $v){
       $stmt-&gt;execute(array_values($v));
      }//end foreach
      $conn-&gt;commit();
      } catch (PDOException $e) {
            echo 'Update failed: ' . $e-&gt;getMessage();
           exit;
             }
      echo "Database was updated successfully";
      $stmt-&gt;closeCursor(); 
      $conn = NULL; 
  </code></pre>
  
  <p><strong>I am always getting "Database was updated successfully" message and data is not getting updated.</strong> In a empty table too i get the same result. There are no errors logged.</p>
  
  <p>mysql column stock_status is varchar and price is decimal(10,4), id is varchar too... Please ignore the errorinfo part as i need to change it. </p>
  
  <p>Is there anything wrong with my pdo update query ?? Help sought..</p>
  
  <p><strong>Update:</strong></p>
  
  <p>var_dump($data) gives price as string:</p>
  
  <pre><code>array(36828) {
        [0]=&gt;
        array(3) {
          ["ID"]=&gt;
          string(5) "75538"
          ["instock"]=&gt;
          string(8) "In Stock"
          ["Price"]=&gt;
          string(7) "82.6900"
        }
  </code></pre>
  
  <p>sample DB structure:</p>
  
  <pre><code> CREATE TABLE IF NOT EXISTS `products` (
        `product_id` int(5) NOT NULL AUTO_INCREMENT,
        `id` varchar(10) COLLATE latin1_general_cs NOT NULL,
        `price` decimal(10,4) NOT NULL,
        `stock_status` varchar(10) COLLATE latin1_general_cs NOT NULL DEFAULT 'In Stock',
        PRIMARY KEY (`product_id`),
        UNIQUE KEY `id` (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs  AUTO_INCREMENT=1 ;
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I have tried this too, but still no updates and no errors. Still getting success message.</p>
  
  <pre><code>    $stmt = $conn-&gt;prepare('UPDATE products SET `stock_status`=:stockstatus,`price`=:price  WHERE `id`=:id');
      foreach ($data as $v){
      $stmt-&gt;bindParam(':stockstatus', $v['instock'], PDO::PARAM_STR);
      $stmt-&gt;bindParam(':price', $v['Price'], PDO::PARAM_INT);
      $stmt-&gt;bindParam(':id', $v['id'], PDO::PARAM_STR);
      $stmt-&gt;execute();
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I already have exceptions set in my connection connstring file as:</p>
  
  <pre><code>     $conn = new PDO($connStr, $user, $pass); 
       $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
  </code></pre>
  
  <p>And still getting no error message ????</p>
  
  <p><strong>Update:</strong>
  <strong>Issue resolved.</strong></p>
  
  <p>Sorry. My oversight. It was $v['ID'] and not $v['id'] in my code. The important thing was that <strong>it was not producing an error</strong>. </p>