Re: Queries in QuickForm

From: Date: Mon, 01 Sep 2003 06:46:25 +0000
Subject: Re: Queries in QuickForm
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7522@lists.php.net to get a copy of this message
On 1 Sep 2003 at 13:55, Leonie wrote: > Here is a strange problem. > > I have two calls to the database on my QuickForm - the first to get > the data, and the second to update it: > > eg: > > require 'DB.php'; > .. > $dba = DB::connect($dsn, false); > ... > $result = $dba->query($sql); > .. > <data used in form> > .. > function process_data ($values) { > .. > $sql="..."; > $result = $dba->query($sql); > .. > } > > However this causes the error: > > Fatal error: Call to a member function on a non-object in e:\program > files\apache group\apache\htdocs\bmtus\docs\db_admin\users_edit.htm on > line 91 (line 91 is the line calling the second query) > > How do I fix this? put a global $dba; in your function process_data. Or do it via $GLOBALS['dba']->query($sql); The problem is that your $dba-object is not known inside the function and therefor query is no member function. Stefan

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