I am having difficulty converting a date to the format SQL needs during update. The user picks the date using a date picker and this is entered in standard US format. When I save it I want to convert it to the format SQL stores it, but no matter what I have tried it is not working. Here is my current code. I know the date conversion line is correct, but it is not saving to the database, I just get a null?
{
for($i=0;$i<$totalRows_RcdScheduleByMonth;$i++){
$updateSQL = sprintf("UPDATE schedule SET awayteam=%s,hometeam=%s,vs=%s,olddate=%s WHERE id=%s",
GetSQLValueString($POST['awayteam'][$i], "text"),
GetSQLValueString($POST['hometeam'][$i], "text"),
GetSQLValueString($POST['verse'][$i], "text"),
date("Y-m-d",strtotime($POST['a'][$i])),
GetSQLValueString($_POST['Id'][$i], "int"));
mysql_select_db($database_LAMSA13, $LAMSA13); $Result1 = mysql_query($updateSQL, $LAMSA13) or die(mysql_error());
$updateGoTo = "Schedule_ByMonth.php";
if (isset($SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
}