我正在努力寻找解决我的项目错误的方法,有人可以帮助我并向我显示正确的方法吗?
这是我的代码:
$productkey = $_SESSION['key'];
$productuser = $_SESSION['user'];
$productemail = $_SESSION['email'];
// Include Database Connection
require 'assets/sys/config.php';
$query = dbConnect()->prepare("INSERT INTO _system (_product_key, _product_user, _product_email, _site_email, _site_title) VALUES (:_product_key, :_product_user, :_product_email, :_site_title, :site_email)");
$query->bindParam(':_product_key', $productkey);
$query->bindParam(':_product_user', $productuser);
$query->bindParam(':_product_email', $productemail);
$query->bindParam(':_site_title', $_POST['sitetitle']);
$query->bindParam(':_site_email', $_POST['siteemail']);
$query->execute();
我收到的错误:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in
您的绑定参数中有一个错字。:site_email
代替:_site_email
。
顺便说一句...您知道您可以使用一个简单的哈希数组来做到这一点,对吗?只需将键命名为与查询中的占位符相同。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句