Update database_transactions.php. Functions: order_by() adjustment.

This commit is contained in:
Nate
2019-11-05 08:25:41 -07:00
parent c6d5516467
commit 7af2fbf3c8
2 changed files with 7 additions and 9 deletions
+6 -2
View File
@@ -2000,8 +2000,12 @@ function number_pad($number,$n) {
function order_by($col, $dir, $col_default = '', $dir_default = 'asc') {
$col = preg_replace('#[^a-zA-Z0-9-_.]#', '', $col);
$dir = strtolower($dir) == 'desc' ? 'desc' : 'asc';
if ($col != '') { return ' order by '.$col.' '.$dir.' '; }
else if ($col_default != '') { return ' order by '.$col_default.' '.$dir.' '; }
if ($col != '') {
return ' order by '.$col.' '.$dir.' ';
}
else if ($col_default != '') {
return ' order by '.$col_default.' '.$dir_default.' ';
}
}
}