Reply to Re: Call to undefined function: query()

Your name:

Reply:


Posted by Kirsten on 09/29/05 14:55

muelli75 schrieb:
> Hi!
>
> Im getting insane by solving a problem ....
>
> I try to define a function which uses a code-snippet from another file.
> My base are the codes from the great book "WebDataBase-Book by H.
> Williams & D. Lane".
>
> So I try to use
>
>
> $result = $connection->query("LOCK TABLES visitkarte WRITE");
> if(DB::isError($result))
> trigger_error($result->getMessage(), E_USER_ERROR);
>
>
> which works in another .inc very fine.
>
> Look at my .inc for the function VKDataInDB
>
>
>
> <?php
> require_once "db.inc";
> require_once "DB.php";
> require_once "authenticate.inc";
> require_once "visitsontheweb.inc";
>
> // Dieser Errorhandler ist extrem gefährlich da er das root-passwort
> der DB ausgibt!
> //set_error_handler("customHandler");
>
> function VKDataInDB(&$connection)
> {
> //Book Page 641
>
> $connection=DB::connect($dsn, true);
> $cust_id=getCust_id($_SESSION["loginUsername"]);
>
> // Lock Table -- 636
> $result = $connection->query("LOCK TABLES visitkarte WRITE");
> if(DB::isError($result))
> trigger_error($result->getMessage(), E_USER_ERROR);
>
> //Query for the highest ID
> $result = $connection->query("SELECT max(vk_id) FROM visitkarte");
> if (DB::isError($result))
> trigger_error($result->getMessage(), E_USER_ERROR);
> $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
>
> // Die nächste verfügbare vk_id errechnen
> $vk_id = $row["max(vk_id)"] + 1;
>
> //selbst erstellt
> $sql = "INSERT INTO visitkarte cust_id = '{$cust_id}',
> vk_id = '{$vk_id}',
> erstelldatum = NOW(),
> sessionid = '{SID}',
> vorname = '{$_SESSION['vorname']}',
> nachname = '{$_SESSION['nachname']}',
> titel = (),
> plz ='{$_SESSION['plz']}',
> ort ='{$_SESSION['ort']}',
> tel1 ={$_SESSION['telefonnummer']},
> mobil=(),
> strasse={$_SESSION['strasse']},
> homepage=(),
> email={$_SESSION['email']},
> kategorie={$_SESSION['kategorie']},
> hintergrund=(1),
> ";
>
> //Write data
> mysql_query ($sql) or mysql_error();
>
> // Unlock tables
> $result=$connection->query("UNLOCK TABLES");
> if(DB::isError($result))
> trigger_error($result->getMessage(), E_USER_ERROR);
>
> }
> ?>
>
>
> When I call this include.file, i get the following error:
>
> Fatal error: Call to undefined function: query() in
> /raid-1/APACHE/hausstein/www/visits/includes/vkdbfunc.inc on line 18
>
> OK, I havent defined "query" in my .incs, but why works it on another
> place? And why must I declare the variable "$connection" when I dont
> have to do it on another place.
> My "require"-section is extended like in the basefiles form the book.
>
> Questions enough for many answers!
>
> Thanks in advance,
>
> Martin
>
Hi,

auch wenns Deutsch ginge ;)

Try to replace $result->getMessage() with $result->getDebugInfo()
and see a better error discription.

-Kirsten

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация