Seniors moment on date()

Hi everyone and Merry Christmas,

I am having a seniors moment. I have some php code under a button. I want to get, and then store the current date into a MySQL database. The code is below.

$tran_date = date(‘Y-m-d’);

// add the transaction record
$sql = “INSERT INTO jos_invtrxn(authcode,amount, trxnnumber, trxnstatus,customer_id,trxndate) VALUES ($tran_aprove,$inv_amount,$tran_code,$tran_status,$inv_paynum,$tran_date)”;
sc_exec_sql($sql);

The record is entered OK, but the date field is recorded as “0000-00-00” and not “2017-12-19”

What am I doing wrong?

Thanks

Tony

Try to surround $tran_date with quotes (or use macro sc_sql_injection)…

Thanks that worked a treat. Single quotes.