progress-bar

This commit is contained in:
xiaomlove
2021-03-16 21:12:27 +08:00
parent 6cd63a1791
commit a17c573be0
5 changed files with 238 additions and 5 deletions
+20
View File
@@ -187,4 +187,24 @@ class DB
return mysql_fetch_assoc($res);
}
public static function getAll($table, $whereStr, $fields = '*')
{
if ($fields != '*') {
if (is_array($fields)) {
$fields = implode(', ', $fields);
}
}
if (empty($fields)) {
do_log("args: " . json_encode(func_get_args()));
throw new DatabaseException("empty fields.");
}
$sql = "select $fields from $table where $whereStr";
$res = sql_query($sql);
$result = [];
while ($row = mysql_fetch_assoc($res)) {
$result[] = $row;
}
return $result;
}
}