Hi. I am adding 8 fields into a table. I supply 5 of them and the other 3 are added on insertion. The function AddRecord is called using AddRecord($EntryDate,$input,$out,$Reason,$Comment);
My function file has the same number of parameters.
function AddRecord($EntryDate,$input,$out,$Reason,$Comment) // E2002
{
$pdo = connectDB();
$AddDateStamp = time();
$AddDate = date("Y-m-d H:i", $AddDateStamp);
$Transaction = dechex(strtotime($EntryDate));
$Insertion = dechex(time());
$package = md5($Transaction . $Insertion);
$Hilight = 0;
$sqlGetCount = "Select * FROM Bank_Data as Value";
//$QCount = $pdo->query($sqlGetCount);
$stmt = $pdo->prepare($sqlGetCount);
$stmt->execute();
$Count = $stmt->rowCount();
$Count = dechex($Count += 256);
$Tag = substr(($Count . $Transaction . $Insertion . $package),0,32);
$sqlList = "
INSERT INTO Bank_Data SET
EntryDate = :Entry,
Input = :In,
Output = :Out,
Reason = :Reason,
Comment = :Coment,
AddDate = :AddDate,
Tag = :Tag,
B = :B
";
$stmt = $pdo->prepare($sqlList);
$stmt->execute([
':EntryDate' => $EntryDate,
':input' => $input,
':out' => $out,
':Reason' => $Reason,
':Comment' => $Comment,
':AddDate' => $AddDate,
':Tag' => $Tag,
':B' => $Hilight
]);
return;
}
// Up to here
/*
function GetReason() // E2001
{
$sqlList = "SELECT * FROM Bank_Reason Order by Reason ASC";
$qList = mysql_query($sqlList) or die ("E2001-01A");
return $qList;
}[code]
Table
[code]CREATE TABLE `Bank_Data` (
`EntryDate` date DEFAULT NULL,
`Input` decimal(6,2) NOT NULL DEFAULT '0.00',
`Output` decimal(6,2) NOT NULL DEFAULT '0.00',
`Reason` tinyint(1) NOT NULL DEFAULT '0',
`Comment` varchar(32) NOT NULL DEFAULT '',
`AddDate` datetime NOT NULL,
`Tag` varchar(45) NOT NULL DEFAULT '',
`B` tinyint(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;