Re: DB_DataObject

From: Date: Wed, 25 Aug 2004 16:59:12 +0000
Subject: Re: DB_DataObject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14291@lists.php.net to get a copy of this message
On Wed, 25 Aug 2004 17:41:48 +0100, Tomek Klas <tomek@tomekklas.com> wrote: > Hello, > > I am doing a registration system using DataObject and HTML_QuickForm. > > It's a bit strange, but all of the sudden, my custom rule stopped > working. > > To be precise, the DataObject inside throws out a message: > DB_DataObject Error: No database name / dsn found anywhere > > Offending script: > > function username_exists($element_name, $element_value) { > $check_username = new DataObject_Protocols_users; Likely this isn't your problem, but you're supposed to use the factory to create DataObjects. $check_username = DB_DataObject::factory('protocols_users'); If you do this, you also don't have to (and shouldn't) explicitly include the dataobject file for that table. > $check_username->username=$element_value; > $num_results = $check_username->find(); > > if ($num_results == 0) { > return true; > } > else { > return false; > } > > } > > It works just fine once I take the script out of function.... > > So, what is it, I am missing here? At what point does the error happen? Try putting this at the beginning of the function: DB_DataObject::debugLevel(5); Are you sure you're setting up the configuration? > > Tomek > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.pear.general (#14291) next »