Welcome Guest, Not a member yet? Register   Sign In
Avoid foreach() with Active Record?
#1

[eluser]stevefink[/eluser]
Hi all,

Is there any possibility for avoiding a foreach() construct when using Active Record type queries? For instance, I'm trying to receive just a single row/value from a table which can simply be assigned to a scaler, so using a foreach construct to get the results seems a bit overkill.

Thanks .... as usual. :-)

- sf
#2

[eluser]Michael Wales[/eluser]
Code:
$query = $this->db->getwhere('users',  array('id'=>$id), 1, 0);
$row = $query->row()
echo $row->username;
#3

[eluser]stevefink[/eluser]
Mike,

You're fast!

Thanks as always. :-)
#4

[eluser]Michael Wales[/eluser]
heh - I just so happened to hop into the forums for the first time today and saw this post.

Bet you thought I just sit here refreshing all day, huh?

Note: That usually is the case, I was just really busy at work today and finally got a break.
#5

[eluser]stevefink[/eluser]
I don't blame you for wanting to check out the forums often. The community here is wonderful and a pleasure to be around. Not to mention a kick ass framework that's making my life a lot easier than it normally would. I hope with experience and time I can help as much as you do. :-)




Theme © iAndrew 2016 - Forum software by © MyBB