OOP: Beginer DB question
| From: | T. H. Grejc | Date: | Thu, 13 May 2004 18:17:30 +0000 |
| Subject: | OOP: Beginer DB question | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12472@lists.php.net to get a copy of this message | ||
Hello,
Unill now I have used:
function art_count() {
$sql = 'SELECT id, o_id, title FROM news';
$result = mysql_query($sql, $connection);
$row = mysql_fetch_array($result);
return $row;
}
print_r(art_count());
I have read 'The PHP Anthology Volume 1, Chapter 2 - Object Oriented
PHP' from http://www.sitepoint.com/articlelist/210 Great article about
OOP and Pear.
I'm using examples to refactor my example above to OOP with Pear DB, but
I cant figure how to do that. It should be something like:
function art_count() {
$sql = 'SELECT id, o_id, title FROM news';
$res = $db->getAll($sql, DB_FETCHMODE_ASSOC);
return $res;
}
but it gives me error.
TNX
--
Please do not CC me.