将mysql_num_rows更新为新的Mysqli标准:mysqli_stmt_num_rows(update mysql_num_rows to new Mysqli standard: mysqli_stmt_num_rows)
我有一个PHP页面,其中包含一些我试图从MySql转换的Mysqli。 我想我已经正确转换了大部分内容,但是当我尝试执行代码时,我收到以下错误消息(如下所示):
Connection was OK! Warning: mysqli_stmt_num_rows() expects parameter 1 to be mysqli_stmt, object given in /quantityremaining5.php on line 25 9999
我对此有点新意,所以请保持温和 - 我做错了什么? 谢谢!
<?php include 'quantitytest_config.php'; // Create connection to MySQL $link = mysqli_connect($hostname, $username, $password); // Check connection if (mysqli_connect_errno($link)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { echo "Connection was OK!\n";} //select a database to work with $selected = mysqli_select_db($link, "grace59_countdown"); // or die("Could not select countdown"); // use if TWO SEPARATE columns for date and time //execute the SQL query and return records $result = mysqli_query($link, "SELECT items FROM cases WHERE datetime<=NOW() Limit 1 "); if(mysqli_stmt_num_rows($result) == 0){ echo "9999"; } else { //fetch tha data from the database while ($row = mysqli_fetch_array($result)) { echo "Quantity:".$row{'items'}."<br>"; } } //close the connection mysqli_close($link); ?>
I have a PHP page with some Mysqli that I am attempting to convert from MySql. I think I've converted most of it correctly, but I am getting the following error message when I try to execute the code (below):
Connection was OK! Warning: mysqli_stmt_num_rows() expects parameter 1 to be mysqli_stmt, object given in /quantityremaining5.php on line 25 9999
I'm a bit new to this, so please be gentle - what is that I'm doing wrong? thanks!
<?php include 'quantitytest_config.php'; // Create connection to MySQL $link = mysqli_connect($hostname, $username, $password); // Check connection if (mysqli_connect_errno($link)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { echo "Connection was OK!\n";} //select a database to work with $selected = mysqli_select_db($link, "grace59_countdown"); // or die("Could not select countdown"); // use if TWO SEPARATE columns for date and time //execute the SQL query and return records $result = mysqli_query($link, "SELECT items FROM cases WHERE datetime<=NOW() Limit 1 "); if(mysqli_stmt_num_rows($result) == 0){ echo "9999"; } else { //fetch tha data from the database while ($row = mysqli_fetch_array($result)) { echo "Quantity:".$row{'items'}."<br>"; } } //close the connection mysqli_close($link); ?>
原文:https://stackoverflow.com/questions/16095749
最满意答案
好的,我解决了这个问题(感谢Justin Balthrop)! 我将memcache gem版本降级到1.3.0,现在一切正常!
另请注意: https : //bugs.launchpad.net/libmemcached/+bug/1216521
或者尝试不同的memcache客户端,例如: https : //bugs.launchpad.net/libmemcached/+bug/1216521
祝你好运! ;-)
Ok i solved the problem (thanks to Justin Balthrop)! I downgraded the memcache gem version to 1.3.0 and now everything works fine!
Watch also at this: https://bugs.launchpad.net/libmemcached/+bug/1216521
Or maybe try a different memcache client like: https://bugs.launchpad.net/libmemcached/+bug/1216521
Good luck! ;-)
相关问答
更多-
您需要安装PHP库memcached,以便您可以使用ZFs Memcached Adapter。 ZF没有memcache库的适配器,所以它试图直接使用没有liboptions的setter的liboptions 。 在配置中安装memcached或删除liboptions ,你应该全部设置。 You need to install the PHP library memcached so you can use ZFs Memcached Adaptor. ZF does not have an adap ...
-
您安装了Memcached客户端(不是Memcache客户端,非常容易混淆,也是Memcached客户端)。 改为使用Memcached类 。 如果你想知道两个客户端之间的区别是什么:这是一个很好的比较表 。 You installed the Memcached client (not the Memcache client, which is, very confusingly, also a Memcached client). Use the Memcached class instead. In ...
-
Memcache&php:致命错误:未找到类'Memcache'(Memcache & php: Fatal error: Class 'Memcache' not found in)[2022-08-01]
这个讨论已经沉默,所以我想发布我的修复(我刚刚结束)。 基本上,我停止使用我的os(mac osX 10.5.3)附带的apache / php组合并重新安装。 我第一次尝试自制软件,但在尝试安装wget时遇到了一堆错误,然后在尝试安装justin hileman的php公式时再次出现错误。 因此,作为自制程序故障排除过程的一部分卸载了macport,我重新安装了macport并安装了所有内容。 然而,macports很糟糕,并没有正确安装php与mysql支持,所以我只是抓住我想要的PHP二进制文件并使用 ... -
使用什么而不是memcache(What to use instead of memcache)[2023-06-20]
Redis ! 这就像关于类固醇的记忆(好的)。 这 是 一些 司机 。 Redis是一家高级键值商店。 它与memcached类似,但数据集不是易失性的 ,值可以是字符串,与memcached完全相同,但也包括列表,集合和有序集 。 所有这些数据类型都可以通过原子操作来操作以推送/弹出元素,添加/删除元素,执行服务器端并集,交集,集合之间的差异等等。 Redis支持不同类型的排序功能。 Redis! It's like memcache on steroids (the good kind). Here ... -
这里的游戏很晚,但如果你只在一台服务器上运行,memcached会降低你的速度。 用APC研究本地缓存(或者,在你的情况下,使用xcache的本地缓存)。 我确信Drupal会为这些插件提供插件。 我的猜测是你使用xcache作为操作码缓存,但不使用它的内存缓存功能。 任何类型的缓存都不是银弹。 就像CyberDem0n提到的那样,你的应用必须足够聪明才能使用它:“缓存这个,不要缓存,缓存,等等等等。” 只有当您处理多个服务器并需要共享缓存时, Memcached才会很棒。 如果您有一台服务器,那么当您只能 ...
-
memcached服务实际上并不为你安装PHP memcached扩展。 它只安装用于存储缓存的memcached服务器。 您需要首先从PECL存储库下载Windows DLL ( 单击蓝色的Windows DLL链接 )。 然后,您必须将extension=php_memcache.dll行添加到SAPI的正确php.ini文件中。 另外,请注意扩展DLL文件需要放在XAMPP安装的正确路径中。 对于Apache,只需使用如果它仍在发生,请提交一个错误,但我怀疑它只是一个短暂的问题。 顺便提一下,您的Value初始化程序不必要地复杂。 这将是相同的: cache_item = &memcache.Item{ Key: memkey, Value: []byte(img_data), } If it's still happening, file a bug, but I suspect it was just a transient problem. Incidentally, your Value i ...我能够解决这个问题。 我所要做的就是刷新然后使用nodetool运行压缩。 我只缺少一些文学作品。 I was able to resolve this issue. All I had to do was flush and then run compaction using nodetool. All I was missing a little literature.您可以尝试创建一个php_info页面来检查模块是否已加载。 info.php的 参考: http : //www.phpinfofile.com/ 我使用PHP 5.5.9并且memcache工作正常。 请注意,我正在使用* nix机器。 memcache memcache support => enabled Active persistent connections => 0 Version => 2.2.7 Revision => $Revision: 32 ...好的,我解决了这个问题(感谢Justin Balthrop)! 我将memcache gem版本降级到1.3.0,现在一切正常! 另请注意: https : //bugs.launchpad.net/libmemcached/+bug/1216521 或者尝试不同的memcache客户端,例如: https : //bugs.launchpad.net/libmemcached/+bug/1216521 祝你好运! ;-) Ok i solved the problem (thanks to Justin ...
相关文章
更多- 《数据结构与STL》(Data Structures and the Standard Template Library)扫描版[PDF]
- mysql问题
- [Hive] 完全分布式安装过程(MetaStore: MySQL)
- sqlite怎么做多表关联。。。
- 关于netbeans和mysql的问题
- solr 索引mysql DIH 链接
- 微信公众平台开发(九) 数据库操作
- MapReduce直接连接MySQL获取数据
- 关于mysql 的 sql
- Setting up Nutch 2.1 with MySQL to handle UTF-8
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。