[eluser]LoRdCoStE[/eluser]
Hi,
as title say actually active record class does not support FIELD function in db->order_by.
The problem is that A.R. try to escape the function.
ex:
Code:
$this->db->order_by("FIELD(id, 129084,126792)");
produce:
ORDER BY FIELD(id, `129084`, `126792)`
but the correct query is:
ORDER BY FIELD(`id`, '129084', '126792')
a temporary fix (not a good fix) is:
Code:
/* Location: ./system/database/DB_active_rec.php */
function order_by($orderby, $direction = '')
{
if (strpos($orderby, 'FIELD(') !== FALSE || strpos($orderby, 'FIELD (') !== FALSE)
{
$this->ar_orderby[] = $orderby;
return $this;
}
// ...
}
Hope to see that implemented in the next version of CI.
Bye