Re: [DB] [DB_DataObject] dataobject empty (DB Error: no database selected)
| From: | Stijn de Reede | Date: | Mon, 28 Feb 2005 16:34:50 +0000 |
| Subject: | Re: [DB] [DB_DataObject] dataobject empty (DB Error: no database selected) | ||
| References: | 1 | Groups: | php.pear.dev php.pear.general |
| Request: | Send a blank email to pear-dev+get-36420@lists.php.net to get a copy of this message | ||
Ok, even stranger, I've got it working now. It seems the autoloader (factory method) had some problems.
I solved it by manually requiring all the DataObjects, and by using
$content_text = &DB_DataObject::factory('Content_text');
instead of
$content_text = DB_DataObject::factory('Content_text');
I've got no clue why this needs to be done, but it works...
Can anyone shed some light on this?
Stijn
Stijn de Reede wrote:
Hi all, I've got a very strange problem. I'm moving my CMS I wrote from my own dev pc to a shared hosting account. Since I don't have the permission to install new PEAR package there, I put it there manually, with go-pear.php. The PEAR php files are in /home/rcb/pear/PEAR, and the DataObjects files are in /home/rcb/DataObjects/DataObjects. I had to copy them there manually after creating them on a different host, since createTables.php had the same problem (DB Error: no database selected). Please look at http://www.racketcentrum-bilthoven.nl/test.phps for the test example. As I said, the problem is very weird. After calling for example the selectAdd() method once, the second time it fails, because the object doesn't exist anymore. After calling the get() method, the object only exists for 2 lines, when I print_r it. With DB_DataObject::debugLevel(1) I saw in a different file (http://www.racketcentrum-bilthoven.nl/site/php/content_text.php?action=show&id=1) the "DB Error: no database selected" error. When I debugged this, I found out that instead of storing a resource in the connection variable, it stored a "1". mysql.php failed on this in the simpleQuery() method, returning the "DB Error: no database selected". Some version info: PEAR: Installed packages: ===================Package Version State Archive_Tar 1.2 stable Console_Getopt 1.2 stable DB 1.6.8 stable DB_DataObject 1.7.2 stable Date 1.4.3 stable HTML_BBCodeParser 1.1 stableHTML_Template_Xipe 1.7.6 stableLog 1.8.7 stable Mail 1.1.4 stable Net_SMTP 1.2.6 stable Net_Socket 1.0.6 stable PEAR 1.3.5 stable Tree 0.2.4 beta XML_Parser 1.2.5 stable XML_RPC 1.2.0 stablePHP: 4.3.10 (Server API CGI) MySQL: Client API version 3.23.58I hope someone can help me, Stijn