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

[eluser]jedd[/eluser]
[quote author="punchi" date="1260745667"]
Code:
foreach ($query->result_array() as $row)
{
    echo $row[0]; //tried $row['0'];
    echo $row[2]; //tried $row['2'];
}
[/quote]

Either a) reassess why you want to be able to this (as you might be happier to just use the normal array walking functions of PHP - like everyone else does), or b) in the model you can massage your return data to look like this (I really do prefer option (a))).

For example:
Code:
$rows = $query->result_array();
$retdata = array();
foreach ($rows as $row)
    $retdata[] = $row;
return $retdata;


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