mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
custom fields in upload.php
This commit is contained in:
+10
-3
@@ -152,9 +152,6 @@ class DB
|
||||
|
||||
public static function update($table, $data, $whereStr)
|
||||
{
|
||||
if (empty($table) || empty($data) || !is_array($data) || empty($whereStr)) {
|
||||
throw new DatabaseException("require table and data(array) and whereStr.");
|
||||
}
|
||||
$updateArr = [];
|
||||
foreach ($data as $field => $value) {
|
||||
$updateArr[] = "`$field` = " . sqlesc($value);
|
||||
@@ -164,6 +161,16 @@ class DB
|
||||
return mysql_affected_rows();
|
||||
}
|
||||
|
||||
public static function delete($table, $whereStr, $limit = null)
|
||||
{
|
||||
$sql = "delete from $table where $whereStr";
|
||||
if (!is_null($limit)) {
|
||||
$sql .= " limit $limit";
|
||||
}
|
||||
sql_query($sql);
|
||||
return mysql_affected_rows();
|
||||
}
|
||||
|
||||
public static function getOne($table, $whereStr, $fields = '*')
|
||||
{
|
||||
if ($fields != '*') {
|
||||
|
||||
Reference in New Issue
Block a user