Fatal error: Call to a member function query() on a non-object in C:\Xampp\xa...

From: Date: Wed, 28 Jun 2006 09:10:14 +0000
Subject: Fatal error: Call to a member function query() on a non-object in C:\Xampp\xa...
Groups: php.general 
Request: Send a blank email to php-general+get-238769@lists.php.net to get a copy of this message
Hello Following code shows within I have some difficulties. Is only an example from "Web Databasse Applications with PHP and MysQL" book. global $dsn; global $connection; $template->setCurrentBlock(); $template->setVariable("SUCH-KRITERIUM","Such-Kriterium: {$_SESSION["searchFormVars"]["search_eb"]}"); $browseString = "search_eb=" . urlencode($_SESSION["searchFormVars"]["search_eb"]); $search = ($_SESSION["searchFormVars"]["search_eb"]); $template->parseCurrentBlock(); $query = setupQuery($_SESSION["searchFormVars"]["search_eb"]); $result = $connection->query($query);--------------------------------------> This code shows me following error message, see below if (DB::isError($result)) trigger_error($result->getMessage(), E_USER_ERROR); $numRows = $result->numRows(); Fatal error: Call to a member function query() on a non-object in C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line 81 Even though the $connection has already been established in a other .php file. However, it should work since there is a global declaration. best regards, Joerg

« previous php.general (#238769) next »