gpt4 book ai didi

php - 提供的参数不是有效的 MySQL

转载 作者:行者123 更新时间:2023-12-01 00:40:38 26 4
gpt4 key购买 nike

$qs = 'SELECT cnam,COUNT(*) as cnt FROM cdr WHERE '.$where.' GROUP BY COUNT(*)';
$objRs = mysql_query($qs);
while($obj = mysql_fetch_array($objRs))
{
if ($obj['cnam'])
{
$names[$obj['cnam']]['call_name'] += $obj['cnt'];
}
}

foreach($names as $h=>$count)
{
if ($h)
{
echo '<operator name="'.$h.'" '.($count['call_name'] ? 'callcenter="'.$count['call_name'].'"' : "").'></operator>';
}
}
echo '</operators>';

我做错了什么?它说问题就在这里:

mysql_fetch_array(): supplied argument is not a valid MySQL

while($obj = mysql_fetch_array($objRs))

不知道我的错误在哪里。

最佳答案

您不能group by 聚合函数。我想你打算:

SELECT cnam, COUNT(*) as cnt
FROM cdr
WHERE '.$where.'
GROUP BY cnam;

关于php - 提供的参数不是有效的 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33345542/

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