Welcome Guest, Not a member yet? Register   Sign In
Simple question : can't define query result without foreach ?! And I thought I wasn't a noob anymore ....
#6

[eluser]xwero[/eluser]
the result method returns an array filled with objects so in order to get the id property of the first object in the array you would have to do
Code:
$rows = $query->result();
$row = $rows[0];
echo $row->id;
Of course this can be cleaned up if you use
Code:
$row = $query->row();
echo $row->id;


Messages In This Thread
Simple question : can't define query result without foreach ?! And I thought I wasn't a noob anymore .... - by El Forum - 06-25-2008, 06:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB