【发布时间】:2013-04-14 06:06:04
【问题描述】:
我有这个问题:
$result2 = mysql_query("SET @total=0;
SELECT *,
@total:= @total+ `companyearned` AS `total`
FROM `recordedhours` WHERE `group` = '$uid'
ORDER BY `unixdate` DESC, `idnum` DESC
LIMIT $from, $max_results");
while ($rowb = mysql_fetch_array($result2)) {
//DO STUFF
}
但是 SET @total=0;使 while 行给我一个错误: 警告:mysql_fetch_array():提供的参数不是有效的 MySQL 结果资源 查询在 phpmyadmin 中运行良好,而在没有 SET @total=0;
的情况下运行良好【问题讨论】:
-
你不能在调用
mysql_query()时给出多个查询。
标签: php mysql while-loop set