dq1230123 2016-01-18 20:51
浏览 51

在非对象[重复]上调用成员函数bind_param()

This question already has an answer here:

I hate to ask this question but I have searched and searched and done all sorts of things to see if I can resolve on my own.

Call to a member function bind_param() on a non-object

var_dump = bool(false)

$stmt = $mysqli->prepare("INSERT INTO resetPswd (userID,key,date,status) VALUES (?,?,NOW(),0)");

$stmt->bind_param('is', $userID,$key);

$stmt->execute();

I have removed everything then added all back the problem lies with "key", it works until I add that in.

I am creating a random 'key':

 $key = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);

db = key - varchar(12)

Any help would be great! Why am I using mysqli? It's required.

</div>
  • 写回答

3条回答 默认 最新

  • dp411805872 2016-01-18 20:55
    关注

    That error means that the call to $mysqli->prepare returned something that isn't an object, my guess would be it returns something like "false" which is not an object and thus you can't call "bind_param" on false. Doesn't sound like $key has anything to do with it.

    评论

报告相同问题?

悬赏问题

  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式