I have been searching for quite a while now and I can't figure out why my query isn't working for dates.
I want it to be imported to my database as a Date, this is a choice from higher up so here I am.
$insert_query = "INSERT INTO enrties(
`datum` )
VALUES (
'".mysql_real_escape_string($_SESSION['Datum'])."')
a few pages before the above i use this piece of code to fill the $_SESSION
$DateDag = $_POST['Dag'];
$DateMaand = $_POST['Maand'];
$DateJaar = $_POST['Jaar'];
switch ($dateMaand)
{
case 'Januari': $DateMaand = '01'; break;
case 'Februari': $DateMaand = '02'; break;
case 'Maart': $DateMaand = '03'; break;
case 'April': $DateMaand = '04'; break;
case 'Mei': $DateMaand = '05'; break;
case 'Juni': $DateMaand = '06'; break;
case 'July': $DateMaand = '07'; break;
case 'Augustus': $DateMaand = '08'; break;
case 'September': $DateMaand = '09'; break;
case 'Oktober': $DateMaand = '10'; break;
case 'November': $DateMaand = '11'; break;
case 'December': $DateMaand = '12'; break;
}
$_SESSION['Datum'] = $DateDag. '-'. $DateMaand. '-'. $DateJaar;
I want to have the date imported as a SQL Date format (preferably DD-MM-YYYY format).
SOLVED, there was a mistake in the switch Apparantly, not really sure what but it works ;)