||02-03-2010 12:46 PM
php mysql using PEAR adodb connecting but returning null ressult
We have recently changed servers and I am having a problem getting php to return results from MySql using the PEAR adodb extension.
PhpMyAdmin connects and returns results fine and I can even go to a SQL box, type in some SQL and get a result back.
However, when I write my own php it connects but the return value from the query is null and I get an error when I try to return FetchRow() from it.
Interestingly the Exception is NOT called.
$DB_Test = &NewADOConnection('mysql');
$DB_Test->PConnect("localhost","username", "password", "db");
$sql = "
MAX(id) as max_id
$result = $DB_Test->Execute($sql);
$row = $result->FetchRow();
$table_id = $row["max_id"];
When I do print_r on $DB_Test it seems to be populated OK
[databaseType] => mysql
[dataProvider] => mysql
[hasInsertID] => 1
[hasAffectedRows] => 1
[metaTablesSQL] => SHOW TABLES
[metaColumnsSQL] => SHOW COLUMNS FROM `%s`
[fmtTimeStamp] => 'Y-m-d H:i:s'
[hasLimit] => 1
[hasMoveFirst] => 1
[hasGenID] => 1
[isoDates] => 1
[sysDate] => CURDATE()
[sysTimeStamp] => NOW()
[poorAffectedRows] => 1
[clientFlags] => 0
[substr] => substring
[nameQuote] => `
[_genIDSQL] => update %s set id=LAST_INSERT_ID(id+1);
[_genSeqSQL] => create table %s (id int not null)
[_genSeqCountSQL] => select count(*) from %s
[_genSeq2SQL] => insert into %s values (%s)
[_dropSeqSQL] => drop table %s
[database] => ivimeds
[host] => localhost
[user] => masteruser
[password] => masteruser
[maxblobsize] => 262144
[concat_operator] => +
[length] => length
[random] => rand()
[upperCase] => upper
[fmtDate] => 'Y-m-d'
[true] => 1
[false] => 0
[replaceQuote] => \'
[genID] => 0
[cacheSecs] => 3600
[memCachePort] => 11211
[arrayClass] => ADORecordSet_array
[numCacheHits] => 0
[numCacheMisses] => 0
[pageExecuteCountRows] => 1
[rsPrefix] => ADORecordSet_
[autoCommit] => 1
[transOff] => 0
[transCnt] => 0
[null2null] => null
[_connectionID] => Resource id #7
[_isPersistentConnection] => 1
[databaseName] => ivimeds
Is there anything missing from the $DB_Object? has anyone come across this before?
The versions I am using are:
PHP Version: 5.2.10
MySQL Server version: 5.0.89-community
||02-03-2010 07:55 PM
Well, not to ask a silly question...
I have no idea what PEAR is, but if it uses Microsoft's ADODB, then I assume this is intended for a Windows server, yes?
And if that is so, then have you installed MyODBC to connect MySQL to ADODB?
||02-04-2010 10:03 AM
PEAR is a collection of PHP extensions.
The adodb is an extension which allows you to connect to many different types of database. It is written in PHP and can be run on any server using PHP. Our server is *nix.
It works on our old server so I am trying to find out what settings could be different and nothing except some very minor PHP and MySQL upgrades (e.g. PHP 5.2.10 rather than 5.2.6).
||02-04-2010 06:19 PM
Fascinating. They use the same acronym the MS uses. "ADODB". Wonder what it stands for in PEAR? ("ActiveX Data Objects" or something like that with MS.)
|All times are GMT +1. The time now is 05:31 PM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.