how to return the current object?
Posted
by ajsie
on Stack Overflow
See other posts from Stack Overflow
or by ajsie
Published on 2010-04-10T21:48:52Z
Indexed on
2010/04/10
21:53 UTC
Read the original article
Hit count: 269
in code igniter you can type:
$query = $this->db->query("YOUR QUERY");
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->body;
}
i guess that the query method returns the object it's part of. am i correct?
if i am, how do you type the line where it returns the object?
so what i wonder is how it looks like inside the query method for the above code to be functional.
public function query($sql) {
// some db logic here with the $sql and saves the values to the properties (title, name and body)
return X
}
with other words, what should X be?
© Stack Overflow or respective owner