Commit b6e35664 authored by Leigh Stoller's avatar Leigh Stoller

Fix max(count) query; no rows means you get a row with a NULL,

so use a having clause.
parent a86a1aca
......@@ -207,7 +207,8 @@ function SHOWFREENODES()
$policy_result =
DBQueryFatal("select max(count) from group_policies as p ".
"where p.policy='type' and p.auxdata='$type' and ".
" (p.pid='-' or $clause)");
" (p.pid='-' or $clause) ".
"having max(count)>=0");
if (mysql_num_rows($policy_result)) {
$row = mysql_fetch_row($policy_result);
......
......@@ -439,7 +439,8 @@ function TBFreePCs($target = null)
$policy_result =
DBQueryFatal("select max(count) from group_policies as p ".
"where p.policy='type' and p.auxdata='$type' and ".
" (p.pid='-' or $clause)");
" (p.pid='-' or $clause) ".
"having max(count)>=0");
if (mysql_num_rows($policy_result)) {
$row = mysql_fetch_row($policy_result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment