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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux