title: How to INSERT date in PHP & Mysqli
body: <p>i have variable <strong>$est_date = "25-02-2015"</strong> this is DD-MM-YYYY format
  so now i need to insert this value in mysql table, the column type is DATE TIME, 
  so i tried like this but the date are not storing in the coloumn est_date,
  it just showing me 00-00-0000 </p>
  
  <pre><code>$mysqli = new mysqli('localhost','root','','smart_marine');
  $insertdate = date("d-m-Y", strtotime($est_date));
  $insert = $mysqli-&gt;prepare("INSERT into repair ( 
                                              cont_details_id,
                                              depot_details_id, 
                                              cont_condition,
                                              est_cost,
                                              currency,
                                              est_date, 
                                              location
                                              )
                                  VALUES (?,?,?,?,?,?,?)");
  
          $phpArray = json_decode($serialize_data, true);
          foreach ($phpArray as $key =&gt; $value)
          { 
              if($value['rate']!=''&amp;&amp; $value['drop']!='')
              {       
              $insert-&gt;bind_param('sssssss',
                                   $value['id'], 
                                   $depot_details_id, 
                                   $value['drop'], 
                                   $value['rate'],
                                   $currency,
                                   $insertdate, 
                                   $location);                                            
              $insert-&gt;execute();
              }
          }
  </code></pre>
  
  <p>please some one help me. </p>
  
  <p>i tried to store like this too </p>
  
  <pre><code>$insert-&gt;bind_param('sssssss',
                                       $value['id'], 
                                       $depot_details_id, 
                                       $value['drop'], 
                                       $value['rate'],
                                       $currency,
                                      STR_TO_DATE($est_date , '%d-%m-%Y'), 
                                       $location);        
  
  but this return error "undefined function STR_TO_DATE"
  </code></pre>