I have a function with a query in it that needs to save the current date to the MySQL DB,
however, when I place “CURDATE()” in my query none of the inputted date from the form will save to the DB at all. I am pretty sure I haven’t got my syntax quite right.
Here’s the function with the query to save everything to the DB
function insert_campaign($userID, $campaign_name,$date_created) {
$campaign_name = $this->real_escape_string($campaign_name);
$this->query("INSERT INTO campaigns (userid, campaign_name,date_created)" .
" VALUES (" . $userID . ", '" . $campaign_name . "', CURDATE()");
}
Any ideas what’s going wrong here?
change this line
to