public function __call($method, $param) { $methods = array('avg', 'max', 'min', 'sum'); if (in_array(strtolower($method), $methods)) { $sql = "select {$method}({$param[0]}) as num from {$this->tableName} {$this->t1} {$this->where}"; $_dataCount = DBTool::queryData($sql); return $_dataCount[0]['num']; } }
public static function getCheckedweek($userID) { $sql = 'select `weeks` from `weekThis` where `userID` =' . $userID; $list = DBTool::queryData($sql); return self::myCheckWeek($list[0]['weeks']); }
/** *查询符合条件的数组 *返回个数 * */ public static function queryData($userId, $bossID, $missionID, $thisCreateTime) { $sql = 'select * from `remind` where `userID` = ' . $userId . ' and `bossID` = ' . $bossID . ' and `missionID` = ' . $missionID . ' and `thisCreateTime` = ' . $thisCreateTime; $list = DBTool::queryData($sql); return count($list); }
public static function actionLoadAreaIdsInWorld() { $areaList = DBTool::queryData('select DISTINCT areaMain,areaSecond,areaThird from area order by areaMain;'); return AreaController::reloadAreaList($areaList); }
if (count($filesExists) > 0) { print '可以使用以下参数删除文件: -rm yes' . "\n"; print '可以使用以下参数更新文件: -update yes' . "\n"; exit; } } } // $_dbModel = new DBModel($_tableName); // $_tableDataKeys = $_dbModel->getMeta(); // if (!is_array($_tableDataKeys) || count($_tableDataKeys)==0) // { // print('中止,表字段获取失败:'.$_tableName."\n"); // exit; // } // $_filedList = DBTool::queryData('show full columns from ' . $_tableName); $_tableDataKeys = array(); $_tableKeysImportantForAdd = array(); foreach ($_filedList as $_fieldRow) { if ($_fieldRow['Key'] == 'PRI') { $_tableIdName = $_fieldRow["Field"]; } else { if (!in_array($_fieldRow["Field"], array('id', 'userID', 'status', 'createTime', 'modifyTime'))) { $_tableKeysImportantForAdd[] = $_fieldRow["Field"]; } } $_tableDataKeys[$_fieldRow["Field"]] = $_fieldRow; } if (!is_array($_tableDataKeys) || count($_tableDataKeys) == 0) { print '中止,表字段获取失败:' . $_tableName . "\n"; exit;