böyle dener misin?
public function getDataW($table, $column, $condition, $orderColumn = "", $orderType = "") {
$allowedOrderColumns = ['id', 'name', 'date'];
$allowedOrderTypes = ['ASC', 'DESC'];
// Order Column ve Order Type'ı doğrulayın
if (!in_array($orderColumn, $allowedOrderColumns)) {
$orderColumn = '';
}
if (!in_array($orderType, $allowedOrderTypes)) {
$orderType = '';
}
$query = "SELECT * FROM {$table}";
if (!empty($column) && $condition !== null) {
$query .= " WHERE {$column}=?";
$params = array($condition);
} else {
$params = [];
}
if (!empty($orderColumn) && !empty($orderType)) {
$query .= " ORDER BY {$orderColumn} {$orderType}";
}
return $this->db->get($query, $params);
}
çalışmadı hocam . datatable kullandığım için olabilir mi?