Reputation: 994
I have checked each part of this block countless times and can't seem to find why my request goes straight to a blank page.
Directly from the database to show spellings are right, where dataID is auto incrementing primary key and checkID and checkAssoc are a unique key together:
SELECT `dataID` , `checkID` , `checkAssoc` , `completed_date` , `time_start` , `time_end` , `esig` , `pass_fail`
FROM `dTraineeCheckListData`
LIMIT 0 , 30
<?php
if (isset($_POST['process'])) {
if(isset($_POST['1startTime']) AND isset($_POST['1endTime']) AND isset($_POST['1signature'])) {
$sql = "INSERT INTO `dTraineeCheckListData` (`checkID`, `checkAssoc`, `completed_date`, `time_start`, `time_end`, `esig`, `pass_fail`) VALUES (?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE `completed_date`=VALUES(`completed_date`), `time_start`=VALUES(`time_start`), `time_end`=VALUES(`time_end`), `esig`=VALUES(`esig`), `pass_fail`=VALUES(`pass_fail`)";
$poststmnt = $db_transpo->prepare($sql);
$poststmnt->bind_param('iiiiiii',$_POST['trainee_id'], 1, NULL, $_POST['1startTime'],$_POST['1endTime'],$_POST['1signature'], NULL);
if ($poststmnt->execute()) {
echo '<div class="alertText">Data Update Successful.</div>';
} else {
echo '<div class="errorText">Some error occured in posting your data update, make sure all fields were filled out for the section.</div>';
printf("Error: %s.\n", $poststmnt->error);
}
$poststmnt->close();
}
}
Upvotes: 1
Views: 44
Reputation: 994
bind_param is pass by variable. I added in the below code and it worked.
$traineeCheckNumber = 1;
$traineeCheckDate = NULL;
$traineeCheckPassFail = NULL;
$poststmnt->bind_param('iiiiiii',$_POST['trainee_id'], $traineeCheckNumber, $traineeCheckDate, $_POST['1startTime'],$_POST['1endTime'],$_POST['1signature'], $traineeCheckPassFail);
Upvotes: 0
Reputation: 1865
Add this line at the top of your script to see errors:
ini_set('error_reporting', -1);
ini_set('display_errors', 'on');
Upvotes: 1