Re: Beginer DB question
| From: | Aidan Lister | Date: | Fri, 14 May 2004 06:22:11 +0000 |
| Subject: | Re: Beginer DB question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12485@lists.php.net to get a copy of this message | ||
Hi Gregj,
Normally it's a good idea to paste the error message
"T. H. Grejc" <php@1203.qwe.uni.cc> wrote in message
news:20040513181907.8842.qmail@pb1.pair.com...
> 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.