Re: database question
| From: | Stig S. Bakken | Date: | Fri, 03 Aug 2001 08:11:14 +0000 |
| Subject: | Re: database question | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1267@lists.php.net to get a copy of this message | ||
mailling@bigfoot.com wrote:
>
> I would like to get after
> SELECT id,text,date FROM mytable
>
> if I have this in the db:
> * ID TEXT DATE
> * --------------------------------
> * 10 'one' 944679408
> * 27 'two' 944679408
> * 34 'three' 944679408
>
> something simlar to this:
> * array(
> * '1' => array(10, 'one', '944679408'),
> * '2' => array(27, 'two', '944679408'),
> * '3' => array(34, 'three', '944679408')
>
> I would like to know if that already exists? if yes, what is the fetch mode
Try this:
$arr = $dbh->getAll("SELECT id,text,date FROM mytable");
It will be indexed numerically from 0 and up, not with strings from 1
like in your example.
- Stig