gpt4 book ai didi

php - 通过 mysqli_fetch_object 无法从该查询中获取计数

转载 作者:行者123 更新时间:2023-11-29 20:14:59 25 4
gpt4 key购买 nike

这是我对计数值及其计数的查询

echo $getq2 = "SELECT publisher,COUNT(publisher) from (select publisher from wiley where $getq2_ UNION ALL SELECT publisher FROM elsevier WHERE $getq2_ UNION ALL SELECT publisher FROM sage WHERE $getq2_  UNION ALL SELECT publisher FROM indianjournal WHERE $getq2_) as publisher Group by publisher order by publisher";

$getquery1 = $conn->query($getq2);
after the query fetching through

while($runrows =mysqli_fetch_object($getquery1))
{
print_r($getquery1);

echo $pub=$runrows->publisher;
//getting the publisher list
echo $count=$runrows->count['publisher'];
//not grtting the publisher count
}

我得到了出版商,但没有得到计数。我怎样才能得到计数?结果正常

最佳答案

将查询更改为这样。

echo $getq2 = "SELECT publisher,COUNT(publisher) as publisherCount from (select publisher from wiley where $getq2_ UNION ALL SELECT publisher FROM elsevier WHERE $getq2_ UNION ALL SELECT publisher FROM sage WHERE $getq2_  UNION ALL SELECT publisher FROM indianjournal WHERE $getq2_) as publisher Group by publisher order by publisher";

并使用 echo $pub=$runrows->publisherCount 获取发布者计数

关于php - 通过 mysqli_fetch_object 无法从该查询中获取计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39846130/

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