title: STR_TO_DATE in Update Query using PDO
body: <p>I'm trying insert data into DATETIME column with PDO statement and the result that i got it is NULL</p>
  
  <p>i'm doing this with 2 steps.</p>
  
  <p>First step :</p>
  
  <pre><code>$this-&gt;params = array_map(function ($val) {
  
  
          if (preg_match("/^\d+(-)\d+(-)\d+( \d+(:\d+:\d+))$/", $val, $match)) {
  
                  return "STR_TO_DATE( ? , '%d/%m/%y %G:%i:%s')";
  
          } else {
              return "?";
          }
  </code></pre>
  
  <p>Second step:</p>
  
  <pre><code>try {
  
          $query = $this-&gt;dbh-&gt;prepare($sql);
  
          foreach ($this-&gt;values as $key =&gt; $val) {
  
           // exit();   
              $type = is_bool($val)    ? PDO::PARAM_BOOL : PDO::PARAM_STR;
              $type = is_null($val)    ? PDO::PARAM_NULL : PDO::PARAM_STR;
              $type = is_integer($val) ? PDO::PARAM_INT : PDO::PARAM_STR;
  
              $query-&gt;bindValue($key+1, $val, $type);
  
          }
              var_dump($query );
              $query-&gt;execute();
              $this-&gt;dbh-&gt;commit();
  
      } catch (PDOException $e) {
  
          $this-&gt;dbh-&gt;rollBack();
          echo $e-&gt;getMessage();
  
      }
  </code></pre>
  
  <p>Query string is :</p>
  
  <pre><code>"INSERT INTO `users`
  (userFirstName, userLastName, userEmail, userPassword, userRegisterDate, userIP)
   VALUES (?, ?, ?, ?, STR_TO_DATE( ? , '%d/%m/%y %G:%i:%s'), ?)"
  </code></pre>
  
  <p>all looks good but result that i got in field DATETIME is null.
  what i'm doing wrong here??</p>