在 PHP 代码中给 mysql_stmt_execute 的未知预处理语句处理程序 (0) [英] Unknown prepared statement handler (0) given to mysql_stmt_execute in PHP code

查看:66
本文介绍了在 PHP 代码中给 mysql_stmt_execute 的未知预处理语句处理程序 (0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一些 PHP 代码,使用 mysqli 扩展和准备好的语句将一些数据插入到 MySQL 表中.MySQL 服务器运行的是 5.0.77 版本.

I've written some PHP code to insert some data into a MySQL table using the mysqli extension and prepared statements. The MySQL server is running version 5.0.77.

我在运行 5.5.27 版的机器上本地测试了代码,它运行得非常好.当我将代码传输到旧版本 MySQL 的服务器时,我收到错误每次都给 mysql_stmt_execute 的未知准备语句处理程序 (0)".

I tested the code locally on my machine running version 5.5.27 and it runs perfectly fine. When I transfer my code to the server with the older version of MySQL, I get the error "Unknown prepared statement handler (0) given to mysql_stmt_execute" each time".

我在谷歌上搜索了很多这个错误,只找到了错误报告,这些报告似乎都在 5.0.77 版本之前得到了修复.另一个奇怪的事情是报告有时会提到错误消息中的数字更改,而在我的情况下,无论我同时从多少个不同的浏览器打开连接,数字都保持不变为 0.

I've googled for this error a lot and only found bug reports which all seem to have been fixed before version 5.0.77. The other strange thing is that the reports sometime mention the number in error message changing, while in my case, the number remains constant at 0, regardless of how many different browsers I simultaneously open a connection from.

我无法升级服务器,因为它不在我的控制之下,而且还为许多其他用户提供服务.

I can't upgrade the server, since it is not under my control, and serves a lot of other users as well.

有没有人知道可能会发生什么,或者如何解决?非常感谢.

Does anyone have any ideas what might be happening, or how to fix it? Thank you very much.

编辑

PHP 代码粘贴在 http://pastebin.com/1X4f5G5Z.我添加了一些注释,应该有助于理解这些函数的作用.

The PHP code is pasted at http://pastebin.com/1X4f5G5Z. I've added some comments that should help understand what the functions do.

我在 mysqli 扩展上使用包装类,如 http://www.php.net/manual/en/mysqli-stmt.bind-param.php#110363

I am using wrapper classes over the mysqli extention as provided at http://www.php.net/manual/en/mysqli-stmt.bind-param.php#110363

推荐答案

我尝试了很多方法都没有成功.这可能是 MySQL v5.0.77 中的一个错误.

I tried a lot of things without any success. This is possibly a bug in MySQL v5.0.77.

通过在评论中采用@robert-rozas 的解决方法并将我的代码迁移到 mysqli 扩展,我终于让我的代码工作了,现在它工作得很好!在这里重新发布以解决问题.

I finally got my code to work by resorting to the workaround by @robert-rozas in the comments and migrating my code to mysqli extension, and now it works great! Reposting here to resolve the question.

这篇关于在 PHP 代码中给 mysql_stmt_execute 的未知预处理语句处理程序 (0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆