pythontr.com
/** * Order By Field * * Order By Field allows you to specify the order * of an MySQL result - useful if you want to * order by a where_in() query. * * @param string $row * @param array/string $values * @return object */ function order_by_field($row, $values) { /* Clean the row */ $row = $this->_protect_identifiers($row); /* Clean and implode the values */ if(is_array($values)) { foreach($values as $key => $value) { $values[$key] = $this->escape($value); } $values = implode(',', $values); } else { $values = $this->escape($value); } /* Build the query */ $query = "FIELD({$row}, {$values})"; $this->ar_orderby[] = $query; return $this; }
Yorumlar