public static BuildSQLDelete ( string $tableName, array $whereArray = null ) : string | ||
$tableName | string | The name of the table |
$whereArray | array | (Optional) An associative array containing the column names as keys and values as data. The values must be SQL ready (i.e. quotes around strings, formatted dates, ect). If not specified then all values in the table are deleted. |
return | string | Returns the SQL DELETE statement |
public static function BuildSQLDelete($tableName, $whereArray = null)
{
$sql = "DELETE FROM `" . $tableName . "`";
if (!is_null($whereArray)) {
$sql .= self::BuildSQLWhereClause($whereArray);
}
return $sql;
}
/** * delete exp entry * * @param integer $usr_ID * @param integer $id -> ID of record * @global array $kga kimai-global-array * @author th */ function exp_delete_record($id) { global $kga, $conn; $filter["exp_ID"] = MySQL::SQLValue($id, MySQL::SQLVALUE_NUMBER); $table = $kga['server_prefix'] . "exp"; $query = MySQL::BuildSQLDelete($table, $filter); return $conn->Query($query); }