PDO bind_param 是未定义的方法
问题描述
我正在远离 mysql 和 mysqli,因为 stackoverflow 上的许多用户一直在说好话.
I'm moving away from mysql and mysqli as many users on stackoverflow are constantly saying good things about it.
我制作了一个数据库类并对此进行了测试,这可以很好地连接到数据库.我试图更新我准备好的语句以匹配但是我在陌生的领域并最终收到以下错误:
I've made a database class and have tested this, this connects fine to the database. I've tried to update my prepared statements to match however I am in unfamiliar territory and have ended up getting the following error:
Fatal error: Call to undefined method PDOStatement::bind_param() in E:xampphtdocsimanageinsert.php on line 50
这反映了这一行:
$stmt->bind_param("s", $_POST['email']);
另外,关于这个,我得到了数据库连接成功和关闭语句返回给我以及致命错误,例如:
Also in regards to this I am getting the database connection success and close statements returned to me as well as the fatal error e.g:
连接数据库成功!连接数据库成功!断开数据库连接成功!
我将解释我想要实现的目标:
I'll explain what I am trying to achieve:
- 在注册用户之前检查数据库中是否存在电子邮件
- 如果是,请告诉用户此电子邮件存在
- 如果不匹配,则将用户插入到用户表中并加密密码
相关代码如下,如果有人能给我一些指导,我将不胜感激.
The relevant code is below and would appreciate if anyone could give me some guidance on this.
index.php
插入.php
connect/class.Database.php
connect/class.Database.php
推荐答案
一些 PDO 示例
绑定参数示例
数组示例
PDO教程
这篇关于PDO bind_param 是未定义的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!