我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何获取mysql结果中的行数[关闭]

$sql3 = "SELECT ps.* from posts ps";
$result3 = $conn->query($sql3) or die(mysqli_error());

How can i get the number of rows on that result on php ?

$result3->num_rows

Try searching before asking

Either

$total_rows = mysqli_num_rows ($result3);

or

$total_rows = $result3->num_rows;

will give you the total number of rows from that query. The latter one is the preferred way when doing OO programming.

You read the full API of MySQLi on the PHP website.

Sources:

PHP Documentation

try this

$conn->affected_rows

近期文章

  • wamp和lamp之间的奇怪行为(ubuntu)
  • 如何自动单击指定的链接
  • 如果数据库中的日期在当前日期之前[重复]
  • 减少php中的字母值[关闭]
  • IPv6地址的正则表达式验证[重复]
  • 我如何与PHP和Dot Net数据库结合[关闭]
  • foreach无法正常使用简单的xml [关闭]
  • php如何检查远程服务器上是否存在文件
  • 使用js和php设置并显示表单的倒数计时器
  • 无法通过第47行的参考传递参数2 [关闭]
  • 使用php显示不同格式的mysql结果[关闭]
  • 编辑php字符串
  • 显示搜索结果时无法删除“ARRAY”一词[关闭]
  • 我想用PHP显示我的语言的当前日期[复制]
  • PHP:检查数据库中的最后存储时间是否大于10分钟,然后执行操作
  • 运行PHP脚本
  • 关于查找域名[关闭]
  • 如何在PHP中发送邮件
  • 比较两个DateTime对象[重复]
  • 未向设置提交任何值时未定义的变量[重复]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华