rogerzebra
Technical User
Hi all,
I've a problem when I'm trying to convert my submitted american date format from a form to my MySQL database (european date time). I've tried to solve this on my own and it doesn't work, so I would greately appreciate if someone could take a look at my code and perhaps give me some guidelines on what's wrong with it. When I'm echo the query it gives me a succesful insert. Everything works fine except that the column for date recieved leaves me with no changes. As you can see I have other columns which contains date formats aswell like date_submitted and effective_date which I'll change also. How do I write that in the same string as date recieved and in a string who works?
Thanks for your time in advance.
/rz
I've a problem when I'm trying to convert my submitted american date format from a form to my MySQL database (european date time). I've tried to solve this on my own and it doesn't work, so I would greately appreciate if someone could take a look at my code and perhaps give me some guidelines on what's wrong with it. When I'm echo the query it gives me a succesful insert. Everything works fine except that the column for date recieved leaves me with no changes. As you can see I have other columns which contains date formats aswell like date_submitted and effective_date which I'll change also. How do I write that in the same string as date recieved and in a string who works?
Code:
$date_recieved = (int)$_POST['Year'].'-'.(int)$_POST['Month'].(int)$_POST['Day'];
$query= mysql_query("INSERT INTO submissions (class_code, date_recieved, date_submitted, producer,
name_insured, effective_date, primary_state)
VALUES ('$class_code', '$date_recieved', '$date_submitted', '$producer', '$name_insured', '$effective_date',
'$primary_state')")
or die (mysql_error());
if(!$query){
echo 'There has been an error creating your submission.';
} else {
echo "success in database entry.";
/rz