title: Cannot bind date value using bindvalue function with PDO::PARAM_STR
body: <p>So, I cannot find the solution to the problem I'm having. I'm really new to coding but learned how to start coding using basic HTML, PHP, PDO, and AJAX. So my problem comes from a form that retrieves dates from a calendar using the type=date from the form. The code of the form is down below.</p>
  <pre><code>&lt;div class=&quot;col-lg-4&quot;&gt;
                      &lt;div class=&quot;panel panel-default&quot;&gt;
                          &lt;div class=&quot;panel-heading&quot;&gt;
                              &lt;h3 class=&quot;panel-title text-center&quot;&gt;&lt;i class=&quot;fa fa-bar-chart fa-fw&quot;&gt;&lt;/i&gt; Ingreso de reporte&lt;/h3&gt;
                          &lt;/div&gt;
                          &lt;div id=&quot;alert_success&quot; class=&quot;panel-body&quot;&gt;
  
                                        &lt;br&gt;
                                        
                                          &lt;form method=&quot;post&quot; class=&quot;form-horizontal&quot; role=&quot;form&quot; action=&quot;ajax_form_post.php&quot; id=&quot;insertreport&quot;&gt;
                                                &lt;div class=&quot;form-group&quot;&gt;
                                                      &lt;label class=&quot;control-label col-sm-2&quot; for=&quot;video&quot; style=&quot;color:#777;&quot;&gt;ID de video&lt;/label&gt;
                                                      &lt;div class=&quot;col-sm-10&quot;&gt;
                                                        &lt;input type=&quot;text&quot; name=&quot;video&quot; class=&quot;form-control&quot; id=&quot;video&quot; placeholder=&quot;Ingresa id del video&quot; required&gt;
                                                      &lt;/div&gt;
                                                &lt;/div&gt;
                                                &lt;div class=&quot;form-group&quot;&gt;
                                                      &lt;label class=&quot;control-label col-sm-2&quot; for=&quot;date_i&quot; style=&quot;color:#777;&quot;&gt;Fecha de arriendo&lt;/label&gt;
                                                      &lt;div class=&quot;col-sm-10&quot;&gt;
                                                        &lt;input type=&quot;date&quot; name=&quot;date_i&quot; class=&quot;form-control&quot; id=&quot;date_i&quot; placeholder=&quot;&quot; required&gt;
                                                      &lt;/div&gt;
                                                &lt;/div&gt;
                                                &lt;div class=&quot;form-group&quot;&gt;
                                                      &lt;label class=&quot;control-label col-sm-2&quot; for=&quot;date_f&quot; style=&quot;color:#777;&quot;&gt;Fecha de devolución&lt;/label&gt;
                                                      &lt;div class=&quot;col-sm-10&quot;&gt;
                                                        &lt;input type=&quot;date&quot; name=&quot;date_f&quot; class=&quot;form-control&quot; id=&quot;date_f&quot; placeholder=&quot;&quot; required&gt;
                                                      &lt;/div&gt;
                                                &lt;/div&gt;
                                                &lt;div class=&quot;form-group&quot;&gt;
                                                      &lt;div class=&quot;col-sm-10&quot;&gt;
                                                        &lt;input type=&quot;hidden&quot; name=&quot;c_id&quot; class=&quot;form-control&quot; id=&quot;user_id&quot; value=&quot;&lt;?php echo $id ?&gt;&quot; required&gt;
                                                      &lt;/div&gt;
                                                &lt;/div&gt;
                                                &lt;div class=&quot;form-group&quot;&gt; 
                                                  &lt;div class=&quot;col-sm-offset-2 col-sm-10&quot;&gt;
                                                    &lt;input type=&quot;submit&quot; class=&quot;btn btn-primary&quot; name=&quot;update_customer&quot; value=&quot;Enviar&quot;  id=&quot;submitdata&quot;&gt;
                                                  &lt;/div&gt;
                                                &lt;/div&gt;
                                          &lt;/form&gt;
                                          
                              &lt;div class=&quot;text-right&quot;&gt;
                                  &lt;a href=&quot;#&quot;&gt;&lt;i class=&quot;fa fa-arrow-circle-right&quot;&gt;&lt;/i&gt;&lt;/a&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  </code></pre>
  <p>Now the problem starts with this Ajax form I built. BTW the script is working fine, the problem is inside this set of code.</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php 
  
  /****************Get  customer info to ajax *******************/
  
  //require database class files
  require(&quot;includes/pdocon.php&quot;);
  
  //instatiating our database objects
  $db = new Pdocon ;
  
      if(isset($_POST['c_id'])){
  
      $id           =   $_POST['c_id'];
  
      $date_i       =   date(&quot;Y-m-d&quot;, strtotime($_POST['date_i']));
  
      $date_f       =   date(&quot;Y-m-d&quot;, strtotime($_POST['date_f']));
  
      $raw_v_id     =   clean_data($_POST['video']);
  
      $v_id         =   val_int($raw_v_id);
  
      $db-&gt;query('SELECT * FROM videos WHERE v_id = :v_id');
  
      $db-&gt;bindvalue(':v_id', $v_id, PDO::PARAM_INT);
      
      $row = $db-&gt;fetchSingle();
  
      $db-&gt;query('INSERT INTO arriendo (transaccion, c_id, v_id, f_arriendo, f_devolucion)
                  VALUES (NULL, :c_id, :v_id :f_arriendo, :f_devolucion)');
  
      $db-&gt;bindvalue(':f_arriendo', $date_i, PDO::PARAM_STR);
      $db-&gt;bindvalue(':f_devolucion', $date_f, PDO::PARAM_STR);
      $db-&gt;bindvalue(':c_id', $id, PDO::PARAM_INT);
      $db-&gt;bindvalue(':v_id', $v_id, PDO::PARAM_INT);
  
      $run = $db-&gt;execute();
   
  }
    
  
              if($run){
  
                   echo &quot;&lt;p class='bg-success text-center' style='font-weight:bold;'&gt;Valor actualizado &lt;/p&gt;&quot;;
      
               }
  
  ?&gt;
  </code></pre>
  <p>I get the following error:</p>
  <p><strong>Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''2021-08-05', '2021-08-06')' at line 2</strong></p>
  <p>Any help or a little guidance would be greatly appreciated. Thanks in advance.</p>