gpt4 book ai didi

php - Mysql的select返回了多少行?

转载 作者:行者123 更新时间:2023-11-29 06:43:20 24 4
gpt4 key购买 nike

你能建议我如何计算 Mysql select 中返回的行数吗?

$n_quakes = "SELECT COUNT(*) 
FROM earthquakes
WHERE milliseconds >= 1000
AND milliseconds <= 2000
AND magnitude >= 4
AND magnitude <= 8
AND ipocentro >= 50
AND ipocentro <= 800
AND latitude >= 40
AND latitude <= 50
AND longitude >= 30
AND longitude <= 70";

这样我就知道行数了?

在我的代码中不起作用,但我不知道这是错误还是在代码的其他位置。

感谢您的帮助,对我的英语表示抱歉

最佳答案

尝试在

之间使用此方法
$count = mysqli_fetch_array(mysqli_query($coni, "SELECT COUNT(*) as totalCount
FROM earthquakes
WHERE (milliseconds between 1000 and 2000) and (magnitude between 4 and 8) AND (ipocentro between 50 and 800) AND (latitude between 40 and 50) and (longitude between 30 and 70)"));

$actualCount = $count['totalCount'];

关于php - Mysql的select返回了多少行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50640950/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com