-1
中定義
在此處卡住了一段時間。參數編號無效:參數未在
當我嘗試運行代碼我收到此錯誤:
警告:PDOStatement對象::執行():SQLSTATE [HY093]:無效參數 數:參數沒有在 定義/應用/XAMPP/xamppfiles/htdocs/ProjectWebSite/php/PDO.php上 線111
線111是代碼
$result1 = $query1->execute(array(':transactionID'=>$transactionID, ':personalID'=>$array['personalID'],
':description'=>$array['description'], ':cost'=>$array['cost'], ':datetime'=>$array['datetime']) );
function createTransaction($array){
$db = connection();
$stmt = $db->prepare("Select MAX(`transactionID`)+1 AS transactionID FROM transaction ");
$stmt->execute();
$transactionID = null;
$results = $stmt->fetchAll();
foreach ($results as $result) {
$transactionID =$result['transactionID'];
}
if(isset($transactionID)){
$sql = "INSERT INTO `transaction`(`transactionID`, `personalID`, `description`, `cost`, `dateTime`)"
. " VALUES (:transactinID,:personalID,:description,:cost,CAST(:datetime AS DATETIME)";
$query1 = $db->prepare($sql);
$result1 = $query1->execute(array(':transactionID'=>$transactionID, ':personalID'=>$array['personalID'],
':description'=>$array['description'], ':cost'=>$array['cost'], ':datetime'=>$array['datetime']) );
var_dump($result1);
if ($result1){
return $transactionID;
}
return null;
}
}
的第一行
哇男人......謝謝 –