[Cartoweb-users] fetchAll in querying DB

Fabio D'Ovidio fabiodovidio at gmail.com
Fri Mar 28 09:52:28 EDT 2008


YES, i have just done it!
Thank you!!

Oliver Christen ha scritto:
> err, MDB is not DB, thats the functions list:
> http://pear.php.net/manual/en/package.database.db.php
>
> so it's either
> $data =& $db->getAll('SELECT cf, nf, df FROM foo',
>        array(), DB_FETCHMODE_ORDERED);
>
> or
>
> $res =& $db->query('SELECT * FROM mytable');
> while ($row =& $res->fetchRow()) {
>    // Assuming DB's default fetchmode is
>    // DB_FETCHMODE_ORDERED
>    $data[] = $row;
> }
>
> something like that
>
>
>> Hi. Consider this:
>>        $dsn = $this->getConfig()->dbSecurityDsn;
>>         $db = Utils::getDb($db, $dsn);
>>         $sql = "select myval from db";
>>         $res = $db->query($sql);
>>         Utils::checkDbError($res);
>>         $row =& $res->fetchRow(DB_FETCHMODE_OBJECT);
>>         $value = $row->myval ;
>>
>>
>> Now, if query result is >1 how can I do to fetch all results?
>>
>> I try with "fetchAll", but the error is:
>> *Fatal error*: Call to undefined method DB_result::fetchAll(), but I 
>> see:
>> http://pear.php.net/reference/MDB-0.9.2/apidoc/MDB-0.9.2/MDB_common.html#methodfetchAll 
>>
>>
>> ..and how can i do to close DB connection with PEAR?
>>
>> Thanks
>>
>> -- 
>> Ing. Fabio D'Ovidio
>>
>> INOVA Open Solutions s.r.l.
>> Web : http://www.inovaos.it
>> Tel.: 081 197 57 600
>> mail: fabiodovidio at gmail.com
>>
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
>
>



More information about the Cartoweb-users mailing list