Re: Fatal error: Call to a member function query() on a non-object in C:\Xampp\xa...
| From: | David Robley | Date: | Wed, 28 Jun 2006 12:12:14 +0000 |
| Subject: | Re: Fatal error: Call to a member function query() on a non-object in C:\Xampp\xa... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238788@lists.php.net to get a copy of this message | ||
j.kuehne@sign-tronic.ch wrote:
> 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
Haven't you asked this before? You can't pass a result set or a conection id
from one script to another. Full stop.
Cheers
--
David Robley
Washed the cat - took HOURS to get the hair off my tongue!
Today is Prickle-Prickle, the 33rd day of Confusion in the YOLD 3172.