I have implemented both the suggestions above by Feyd and Everah. Changes - i used this to fetch the variables....
Code: Select all
$target_ga_date=$_POST['targetgadate'];
$actual_ga_date=$_POST['actualgadate'];
Then i set them to null and initiated them with user values when the form is posted....
Code: Select all
$target_ga_date = null;
$actual_ga_date = null;
if ($_SERVER['REQUEST_METHOD'] == "POST")
{//<<<...code....>>
if(isset($_POST['targetgadate'])){$target_ga_date = $_POST['targetgadate'];}
if(isset($_POST['actualgadate'])){$actual_ga_date = $_POST['actualgadate'];}
echo "Dates: $target_ga_date \n $actual_ga_date";
}
Also I removed the quotes in the sql insert statement:
Code: Select all
$sql1 = "insert into datahub.targetdetails".
"(lastupdate, servermodeltable_id1, codename, targetesxrelease, targetgadateshort, actualgadateshort, serverformfactortable_id, cputable_id, maxnumbercpus, cpuspeed, stepping, l2cachesize, l3cachesize, frontsidebustable_id, serverchipsettable_id, serverbiostable_id,".
"memoryconfiguration, maxmemorysize, pcislots, pcixslots, pcieslots, satacontroller, sciscontroller, raidcontroller, sascontroller, fchba, iscsihba, expecteddeliverydatetovmware, requiredreturndate, hide, NDA, lvl_1_ecx, lvl_1_edx, lvl_81_ecx, lvl_81_edx)".
"values('$last_update', '$serv_id', '$serv_code', '$targ_esx_release', $target_ga_date, $actual_ga_date, '$form_fac_id', '$cpu_id', '$no_cpu', '$cpu_speed', '$stepping', '$l2_cache', '$l3_cache', '$fsb_id', '$chipset_id', '$bios_id', '$mem_config', '$mem_max', '$pci', ".
"'$pcix', '$pcie', '$sata', '$sci', '$raid', '$sas', '$fc_hba', '$iscsi', $to_vmw_delivery_date, $return_to_partner_date, '2', '1', '$lvl1_ecx', '$lvl1_edx', '$lvl81_ecx', '$lvl81_edx')";
Then i submit the form with NULL values in the date columns.......this error pops up:
Dates: This line should print the dates entered. Since they are null, there is nothing to print
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 ' , '2', '110', '', '', '', '', '', '19', '83', '49', '', '', '', '', '', '2', '2' at line 1insert into datahub.targetdetails(lastupdate, servermodeltable_id1, codename, targetesxrelease, targetgadateshort, actualgadateshort, serverformfactortable_id, cputable_id, maxnumbercpus, cpuspeed, stepping, l2cachesize, l3cachesize, frontsidebustable_id, serverchipsettable_id, serverbiostable_id,memoryconfiguration, maxmemorysize, pcislots, pcixslots, pcieslots, satacontroller, sciscontroller, raidcontroller, sascontroller, fchba, iscsihba, expecteddeliverydatetovmware, requiredreturndate, hide, NDA, lvl_1_ecx, lvl_1_edx, lvl_81_ecx, lvl_81_edx)values('2007-01-04 11:01:50', '614', '', '1', , , '2', '110', '', '', '', '', '', '19', '83', '49', '', '', '', '', '', '2', '2', '2', '2', '2', '2', , , '2', '1', '', '', '', '')
So the i decide to enter some dates and i enter the values for dates and when i submit the form THIS error pops up:
Dates: 2008-01-01 00:00:00 2008-01-01 00:00:00 2007-01-01 00:00:00 2007-05-01 0:00:00 Now it prints the dates correctly. But....."This 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 '00:00:00, 2008-01-01 00:00:00, '2', '110', '', '', '', '', '', '19', '83', '49',' at line 1insert into datahub.targetdetails(lastupdate, servermodeltable_id1, codename, targetesxrelease, targetgadateshort, actualgadateshort, serverformfactortable_id, cputable_id, maxnumbercpus, cpuspeed, stepping, l2cachesize, l3cachesize, frontsidebustable_id, serverchipsettable_id, serverbiostable_id,memoryconfiguration, maxmemorysize, pcislots, pcixslots, pcieslots, satacontroller, sciscontroller, raidcontroller, sascontroller, fchba, iscsihba, expecteddeliverydatetovmware, requiredreturndate, hide, NDA, lvl_1_ecx, lvl_1_edx, lvl_81_ecx, lvl_81_edx)values('2007-01-04 11:01:55', '614', '', '1', 2008-01-01 00:00:00, 2008-01-01 00:00:00, '2', '110', '', '', '', '', '', '19', '83', '49', '', '', '', '', '', '2', '2', '2', '2', '2', '2', 2007-01-01 00:00:00, 2007-05-01 0:00:00, '2', '1', '', '', '', '')
Is this error because of the space i have between date and time - 2007-01-01 00:00:00? or something else? Actually i'm stuck both ways. Any help?????
Thanks...
- Vamsi