Hello to everyone, im having trouble in inserting a date like "2012-12-06" into a database mysql, Im using phpmyadmin+wamp and adobe dreamweaver!I want to use 3 textfields, one for the year, other for the month and a last one for the day, but I always get an error by using this
"$field_final_date1=$field2_date.'-'.$field3_date.'-'.$field4_date;"
I created 4 variables 3 of them ($field2_date,$field3_date,$field4_date) to get the year,month and day and one ($field_final_date1) to join the other 3 to form this "2012-12-06". I can i do this? I made this code here:
<?php
include"connect_database.php";
$field2_date=$_POST['field2'];
$field3_date=$_POST['field3'];
$field4_date=$_POST['field4'];
$field_final_date1=$field2_date.'-'.$field3_date.'-'.$field4_date;
$query = sprintf("insert into despesas_casa values (NULL,'%s','%s','%s','%s','%s','%s','%s','%s')",$_POST['field1'],$_POST[$field_final_date1],$_POST['field5'],$_POST['field6'],$_POST['field7'],$_POST['field8'],$_POST['field9'],$_POST['field10']);
?>