RE: [PEAR-DOC] Sorry, I am the last person to question the docs.. ..as I haven't even started using the lib yet...
| From: | LIMBOURG Arnaud | Date: | Wed, 11 Dec 2002 09:57:06 +0000 |
| Subject: | RE: [PEAR-DOC] Sorry, I am the last person to question the docs.. ..as I haven't even started using the lib yet... | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-113@lists.php.net to get a copy of this message | ||
Ouch, you're right, the example needs fixing.
Arnaud.
> On the fetch page:
> http://pear.php.net/manual/en/core.db.tut_fetch.php
>
>
> Should these two examples in the docs be $db->getAssoc and
> $db->getAll?
>
>
> getAssoc() fetches the entire result set of a query and
> return it as an
> associative array using the first column as the key.
> <?php$data = getAssoc('SELECT name, surname, phone FROM
> mytable')/*Will
> return:array( 'Peter' => array('Smith', '944679408'),
> 'Tomas' =>
> array('Cox', '944679408'), 'Richard' =>
> array('Merz',
> '944679408'))*/?>
>
>
> getAll() fetches all the rows returned from a query
> <?php$data = getAll('SELECT id, text, date FROM mytable');/*Will
> return:array( 1 => array('4', 'four', '2004'), 2 =>
> array('5',
> 'five', '2005'), 3 => array('6', 'six',
> '2006'))*/?>