title: How can I use a MySQL function in my PHP query code?
body: <p>I'm trying to convert a string "date" value from a submitted form into an actual date while doing my insert query. I thought I could use the MySQL function str_to_date, but I'm getting an error message.</p>
  
  <p>Here's my code; this is a Joomla site, so the JRequest::getVar calls are joomla's way of getting submitted _post variables.</p>
  
  <pre><code>$query = "insert into jos_customers_addresses (customer_id,nickname,birthdate)
  values ("
          .$db-&gt;quote($userAcctID).","
          .$db-&gt;quote($nickname).","
          .$db-&gt;quote(STR_TO_DATE(JRequest::getVar('birthdate'),'%m/%d/%Y'))
  .")";
  </code></pre>
  
  <p>I've also tried the birthdate line without the $db->quote, but got the same error. The error message is:</p>
  
  <pre><code>Fatal error: Call to undefined function STR_TO_DATE() in /var/www/html/mysite.com/components/com_arrcard/models/checkoutpay.php on line 156
  </code></pre>
  
  <p>where line 156 is the line containing the str_to_date call. Any ideas?</p>