05-19-2009, 08:31 AM
|
#9 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by allworknoplay
Is this a commonly used mysql function? I know I've seen it before but I know most people just use array or assoc.
I see that it returns the results via object, with no relation to any class at all...and that you can only use names, not the ID's....
Is this really a useful function in everyday mysql use? Just wondering...
|
Almost all MVC frameworks makes use of mysql_fetch_object as their "fetch"-method in their database class. Then they got extra methods for retrieving an array like "fetch_array"(but note that the main fetch method still uses the mysql_fetch_object).
Anyhow.
@topic- I'm not sure what you want here?
What I do in my database class is that every QUERY is a new object of a mysql_result class that I've built.
PHP Code:
//using the mysql_driver class to set some base values: $this->db->table('table')->where('row', 'value')->where('anotherrow', 4)->order_by('row', 'ASC')->limit(10); $query = $this->db->get(); //$query will now be the mysql_result class and I can access methods like: echo $query->num_rows(); foreach($query->fetch() as $row) {
print_r($row);
} //etc.
Is that what you're looking for?
__________________
|
|
|
|