Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord order by random broken on MySQL ?
#2

[eluser]ctype[/eluser]
Look like here also many breaking changes, now don't work old code :
- $this->db->orderby('','RAND()');
- $this->db->where('table.field!=',$user_id); ! but work "where('field!=',$user_id);"

Any way, small (but probably not good) fix:

DB_active_rec.php
function order_by($orderby, $direction = '')
replace line 867
if (strtolower($direction) == 'random')
to
if (strtolower($direction) == 'random' || strtolower($direction) == 'rand()')


mysql_driver.php
function _escape_identifiers($item)

add at top
if ($item == '')
{
return $item;
}

also replace
$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
to
$str = $item;


Messages In This Thread
ActiveRecord order by random broken on MySQL ? - by El Forum - 11-17-2008, 10:32 AM
ActiveRecord order by random broken on MySQL ? - by El Forum - 11-18-2008, 09:20 AM
ActiveRecord order by random broken on MySQL ? - by El Forum - 11-18-2008, 10:28 AM
ActiveRecord order by random broken on MySQL ? - by El Forum - 11-18-2008, 10:40 AM
ActiveRecord order by random broken on MySQL ? - by El Forum - 11-18-2008, 10:46 AM
ActiveRecord order by random broken on MySQL ? - by El Forum - 11-18-2008, 04:21 PM
ActiveRecord order by random broken on MySQL ? - by El Forum - 11-18-2008, 04:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB