Good Day,
I am looking for threads here in daniweb which will contain my question but the return is not similar to my problem..

Please help me..

i don't know what to do with this. I just want to store date field in mysql database but i can't here is the code i am using

the post value is mm-dd-yyyy so i have to convert it to the format that mysql accepts.

//training period

//convert to mysql date format From
$dateFrom =$from;
$dateTimeFrom = new DateTime($dateFrom);

$formatted_from=date_format ( $dateTimeFrom, 'Y-m-d' );

//convert to mysql date format To
$dateTo =$to;
$dateTimeTo = new DateTime($dateTo);

$formatted_to=date_format ( $dateTimeTo, 'Y-m-d' );

$sql="INSERT INTO `transaction` (ProfileID, ProgramID, ProgramName, ModuleID, ModuleName, EnrollmentID, ProgramFee, OJTFee, WorkshopFee, NCAssessment, OtherFees, TotalAmount, Date, From, To)
Values ('$assessprofileid','$assessprogramid', '$assessprogram',$assessmoduleid, '$assessmodule', $assessenrollmentid, $programfee, $ojtfee, $workshopfee, $ncfee, $otherfees, $total, curdate(), '$formatted_from', '$formatted_to')";

// i also tried to remove the quotes from $formatted_from and $formatted_to but i still have an error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'From) Values ('56','42', 'Faculty Development Program',13, 'Housekeeping', 34, ' at line 1

please help me..

thanks in advance

I have provide you the code about how to add date value in my sql.

$query_auto = "INSERT INTO tablename (col_name, col_date) VALUE ('DATE: Auto CURDATE()', CURDATE() )";

This command is for adding current date and

$query_manual = "INSERT INTO tablename (col_name, col_date) VALUES ('DATE: Manual Date', '2008-7-04')";
addind date into Mysql manually