I'm trying to insert the current date into mysql.
When I try
<?php
$date = date('Y-m-d');
echo "$date";
?>
Prints the date in the correct format, i.e. 2009-9-19.
However when I try
<?php
$date=date("Y-m-d");
$TransactionID=1;
$OtherInfo=blah;
$sql = "INSERT INTO testTable (TransactionID, Date, OtherInfo) VALUES ($TransactionID, $date, $OtherInfo)";
//assume proper connection to $db
$testquery = $db->query($sql);
?>
In mysql this produces
1 | 0000-00-00 | blah
:queasy:
I would appreciate any help you guys could offer.