Discussion:
PEAR:MDB2
Damian Bursztyn
2006-11-23 15:09:00 UTC
Permalink
Hi. I already read the documentation at
http://pear.php.net/manual/en/package.database.mdb2.php and trying to work
with MDB2 but have a little problem. I want to make a query settign the
types of the columns so i did this (working with mssql):

$mdb2 =& MDB2::factory($dsn, $options);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
$mdb2->loadModule('Datatype');
$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);

$mdb2->setLimit(20, 10);
$datatypes = array('somedate' => 'date');
$result =& $mdb2->query('SELECT somedate FROM sometable', $datatypes);

// Always check that result is not an error
if (PEAR::isError($result)) {
die($result->getMessage());
}

while (($row = $result->fetchRow())) {
echo $row['somedate'] . "\n";
}

$mdb2->disconnect();
But the answer is something like "MDB2 Error: not found".
Is ok the code i wrote? im missing something?
--
Todos los humanos profundos se deleitan en imitar a los peces
voladores jugando sobre las altas crestas de las olas. Consideran que lo
mejor
de las cosas es su superficie, lo que hay en la epidermis, sit venia verbo.
(Nietzsche)
Lorenzo Alberton
2006-11-23 15:50:26 UTC
Permalink
Hi Damian,
Post by Damian Bursztyn
Hi. I already read the documentation at
http://pear.php.net/manual/en/package.database.mdb2.php and trying to work
with MDB2 but have a little problem. I want to make a query settign the
[snip]
But the answer is something like "MDB2 Error: not found".
Is ok the code i wrote? im missing something?
have you installed the mssql driver?

pear install MDB2_Driver_mssql

If you have, please post the actual error message
you get.

Regards,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
___________________________________________________________________
Quipo Free Internet - 2 email, 150 Mb di spazio web e molto di più.
ADSL, Hardware & Software Online Store
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Lorenzo Alberton
2006-11-23 16:05:27 UTC
Permalink
I al ready install the driver but the message is that one. No more than
MDB2 Error: not found.
try with getUserInfo(), should be more informative:

die($result->getMessage() .'<br />'. $result->getUserInfo());

HTH

Regards,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
___________________________________________________________________
Quipo Free Internet - 2 email, 150 Mb di spazio web e molto di più.
ADSL, Hardware & Software Online Store
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Continue reading on narkive:
Loading...