Hallo zusammen ich stehe gerade vor folgendem Problem und zwar möchte eine vorhandene Tabelle Updaten doch bekomme die ganze Zeit folgenden Fehler:
Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\xampp\htdocs\woocommerce\index.php:46 Stack trace: #0 C:\xampp\htdocs\woocommerce\index.php(46): PDOStatement->execute() #1 {main} thrown in C:\xampp\htdocs\woocommerce\index.php on line 46
Der Code sieht wie folgt aus sieht ihr da ein Fehler? :
Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\xampp\htdocs\woocommerce\index.php:46 Stack trace: #0 C:\xampp\htdocs\woocommerce\index.php(46): PDOStatement->execute() #1 {main} thrown in C:\xampp\htdocs\woocommerce\index.php on line 46
Der Code sieht wie folgt aus sieht ihr da ein Fehler? :
PHP-Code:
foreach($importdata as $row){
foreach($row as $data){
$query = "UPDATE tracker SET (customer_id, subtotal, total, total_line_items_quantity, status, created_at, updated_at, completed_at) VALUES(:customer_id, :subtotal, :total, :total_line_items_quantity, :status, :created_at, :updated_at, :completed_at) WHERE order_id = :id;";
$stha = $affilidb->prepare($query);
$stha->bindParam(":id", $data['id'], PDO::PARAM_INT);
$stha->bindParam(":customer_id", $data['customer_id'], PDO::PARAM_INT);
$stha->bindParam(":subtotal", $data['subtotal'], PDO::PARAM_STR);
$stha->bindParam(":total", $data['total'], PDO::PARAM_STR);
$stha->bindParam(":total_line_items_quantity", $data['total_line_items_quantity'], PDO::PARAM_STR);
$stha->bindParam(":status", $data['status'], PDO::PARAM_STR);
$stha->bindParam(":created at", $data['created_at'], PDO::PARAM_STR);
$stha->bindParam(":updated_at", $data['updated_at'], PDO::PARAM_STR);
$stha->bindParam(":completed_at", $data['completed_at'], PDO::PARAM_STR);
$stha->execute();
// foreach($data['line_items'] as $productdata){
// echo $productdata['name']."<br>";
// echo $productdata['total']."<br><br>";
// }
}
}
Kommentar