Re: DB_FETCHMODE_ASSOC returns an ordered array using MsSQ
| From: | Justin Patrin | Date: | Fri, 27 Feb 2004 00:04:49 +0000 |
| Subject: | Re: DB_FETCHMODE_ASSOC returns an ordered array using MsSQ | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10982@lists.php.net to get a copy of this message | ||
David Dimaria wrote:
Try taking the off the single quotes: DB_FETCHMODE_ASSOC instead of
'DB_FETCHMODE_ASSOC'
-David
-----Original Message-----
From: Frederic Trudeau [mailto:ftrudeau@zesolution.com]
Sent: Thursday, February 26, 2004 4:00 PM
To: pear-general@lists.php.net
Subject: [PEAR] DB_FETCHMODE_ASSOC returns an ordered array using MsSQL
Well, subject is pretty much self explanatory ...
$db = DB::connect('mssql://dbuser:dbpass@dbhost/dbname')
$sql = "SELECT * FROM sometable";
$res = $db->query($sql)
$row =& $res->fetchRow('DB_FETCHMODE_ASSOC');
print_r($row);
output is :
Array
(
[0] => 75
[1] => WOP_SSL
[2] => 0
[3] => {{wop_ssl}}
[4] => [5] => N
[6] => [7] => 0
[8] => [9] => [10] => G
[11] => NETWORK
[12] => G
[13] => NETWORK
[14] => G
[15] => NETWORK
[16] => [17] => )
help ? : )
You could try this just after you connect:
$db->setFetchMode(DB_FETCHMODE_ASSOC);
--
paperCrane <Justin Patrin>