$userName = null; } if(isset($_POST['huaweiId'])){ $huaweiId = $_POST['huaweiId']; }else{ $huaweiId = null; } */ //获取表名 $tableName = $_POST['name']; $start = $_POST['userNum']; //$tableName = "task_regis_1451034019"; $dbModel = new dbModel(); //查询数据条数 $selectCount = "SELECT COUNT(*) FROM " . $tableName; $total = $dbModel->selectEachCount($selectCount); $offSet = $total - $start; //计算偏移量 $defaultStart = $total - 5; $userArr = array(); if ($start == $total) { //数据库已无数据 echo ""; } else { if ($offSet > 5) { //从表中取出最近的用户信息 $selectSql = "SELECT * FROM " . $tableName . " ORDER BY regisTime asc LIMIT " . $defaultStart . ",1"; $selectRes = $dbModel->selectFromTable($selectSql); if (!empty($selectRes)) { while ($row = mysql_fetch_assoc($selectRes)) { array_push($userArr, $row['name']);
public function getSum($tableName = "") { $sqlCount = "SELECT COUNT(*) FROM " . $tableName; $sum = parent::selectEachCount($sqlCount); return $sum; }