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.
//convert to mysql date format From
$dateTimeFrom = new DateTime($dateFrom);
$formatted_from=date_format ( $dateTimeFrom, 'Y-m-d' );
//convert to mysql date format 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