- //* DEBUG: */ echo $search."/".$tableName."/".$lookFor."/".$whereStatement."/".$add."<br />\n";
- if (($onlyRows) || ($lookFor == "userid")) {
+ //* DEBUG: */ echo $search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'<br />\n';
+ if ((empty($search)) && ($search != '0')) {
+ // Count or sum whole table?
+ if ($countRows === true) {
+ // Count whole table
+ $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `{!_MYSQL_PREFIX!}_%s`".$add,
+ array($lookFor, $tableName), __FUNCTION__, __LINE__);
+ } else {
+ // Sum whole table
+ $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `{!_MYSQL_PREFIX!}_%s`".$add,
+ array($lookFor, $tableName), __FUNCTION__, __LINE__);
+ }
+ } elseif (($countRows === true) || ($lookFor == 'userid')) {