HTML_AJAX and MDB2

From: Date: Tue, 03 Apr 2007 21:03:17 +0000
Subject: HTML_AJAX and MDB2
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26993@lists.php.net to get a copy of this message
Hello, I'm trying to use an MDB2 object in My Ajax class which serves the requests. This is my autoserver.php <? require_once 'HTML/AJAX/Server.php'; class AutoServer extends HTML_AJAX_Server { // this flag must be set for your init methods to be used var $initMethods = true; // init method for my hello world class function initHelloWorld() {
     require_once 'HelloWorld.class.php';
     require_once 'MDB2.php';
     require_once 'const.php';
     $hello =new HelloWorld($db);
     //$this->registerClass($hello); for php4
     $this->registerClass($hello,'helloworld',array('checkuser','deposit'));
} } $server = new AutoServer(); $server->handleRequest(); ?> My $db is created in const.php and as you can see I pass it as a parameter to HelloWorld's constructor. This is my HelloWorld.class.php file <?php error_reporting(E_ALL); session_start("ours"); $dir = "../.."; $sep=PATH_SEPARATOR; set_include_path($dir."/includes/pear".$sep. $dir."/includes".$sep. $dir."/includes/functions".$sep. $dir."/includes/classes"); require_once 'MDB2.php'; //MDB2 before const.php require_once 'site_const.php'; //this is the way you set the PATH and include files in THIS FILE which is included //from before.php via autoserver.php require_once 'const.php'; require_once 'functions_draw_site.php'; require_once 'functions.php'; //$user_id = $_SESSION["sess_user_id"]; class HelloWorld { function HelloWord($db){ $this->db= $db; }
     function deposit(){
$row=$this->db->queryRow("SELECT * FROM news WHERE id='1'");
                if (PEAR::isError($this->db)){
 		    die($this->db->getMessage() . ', ' . $this->conn->getUserInfo() );
} if (PEAR::isError($row)){ die($row->getMessage() . ', ' . $row->getUserInfo() ); }
                return $row["text"];
       }
} However i don't get any output when i call the deposit() function( and deposit is really called). When i try to call deposit without any $db object it is ok. Any ideas?Thanks. _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.com/

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