Welcome Guest, Not a member yet? Register   Sign In
mysql_fetch_row() in CodeIgniter
#9

[eluser]punchi[/eluser]
My solution:

Change

Code:
while($row = $this->db->call_function('fetch_row', $query)) {
    $return[] = $row;
}

for

Code:
while($row = mysql_fetch_row($query)) {
    $return[] = $row;
}

The page speed up a 350% (from 0.0035 to 0.0010). The differences between foreach ($query2 as $row) and foreach ($query->result() as $row) are insignificant.

And now, between the "almost-always-used"
Code:
$sql = 'SELECT ID_PLAN, PL_NAME plan';
$query = $this->db->query($sql);

and
Code:
$sql = 'SELECT ID_PLAN, PL_NAME plan';
$query = mysql_query($sql);

        while($row = mysql_fetch_row($query)) {
                $return[] = $row;
        }

return $return;

The last one, its 170% more efficient. Another reason Jedd ;-)

What I don't know, if working with CodeIgnite and PHP native functions, have some incompatibilities or is inappropriate...

Thanks! =)


Messages In This Thread
mysql_fetch_row() in CodeIgniter - by El Forum - 12-12-2009, 10:52 PM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-12-2009, 11:02 PM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 01:00 AM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 11:07 AM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 11:09 AM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 11:14 AM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 11:21 AM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 01:51 PM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 02:57 PM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 03:35 PM
mysql_fetch_row() in CodeIgniter - by El Forum - 12-13-2009, 04:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB