473,788 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Call to undefined function: query()

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 "WebDataBas e-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.i nc";
require_once "visitsontheweb .inc";

// Dieser Errorhandler ist extrem gefährlich da er das root-passwort
der DB ausgibt!
//set_error_handl er("customHandl er");

function VKDataInDB(&$co nnection)
{
//Book Page 641

$connection=DB: :connect($dsn, true);
$cust_id=getCus t_id($_SESSION["loginUsern ame"]);

// 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("SELEC T max(vk_id) FROM visitkarte");
if (DB::isError($r esult))
trigger_error($ result->getMessage() , E_USER_ERROR);
$row = $result->fetchRow(DB_FE TCHMODE_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={$_SESS ION['strasse']},
homepage=(),
email={$_SESSIO N['email']},
kategorie={$_SE SSION['kategorie']},
hintergrund=(1) ,
";

//Write data
mysql_query ($sql) or mysql_error();

// Unlock tables
$result=$connec tion->query("UNLOC K 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 "$connectio n" 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

Sep 28 '05 #1
1 9124
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 "WebDataBas e-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.i nc";
require_once "visitsontheweb .inc";

// Dieser Errorhandler ist extrem gefährlich da er das root-passwort
der DB ausgibt!
//set_error_handl er("customHandl er");

function VKDataInDB(&$co nnection)
{
//Book Page 641

$connection=DB: :connect($dsn, true);
$cust_id=getCus t_id($_SESSION["loginUsern ame"]);

// 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("SELEC T max(vk_id) FROM visitkarte");
if (DB::isError($r esult))
trigger_error($ result->getMessage() , E_USER_ERROR);
$row = $result->fetchRow(DB_FE TCHMODE_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={$_SESS ION['strasse']},
homepage=(),
email={$_SESSIO N['email']},
kategorie={$_SE SSION['kategorie']},
hintergrund=(1) ,
";

//Write data
mysql_query ($sql) or mysql_error();

// Unlock tables
$result=$connec tion->query("UNLOC K 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 "$connectio n" 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
Sep 29 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2029
by: Netocrat | last post by:
Any comments on the correctness of the statements 1, 2a, 2b, 3 and 4 in the code below? If they are correct, then the definition of an object as well as that of an lvalue is broken in C99 by the following reasoning: foo() does not return an object, so the return of foo() conceptually is not stored, yet we are able to obtain a pointer to one of its member elements, therefore it must be stored, therefore foo() does return an object,...
3
5150
by: dumbledad | last post by:
Hi All, I know this comes up lots but I have tried the previously posted solutions and they are not working for me. I have a new installation of MySQL and PHP running on Windows Server 2003 SP2 with IIS 6. I installed MySQL 5.0.20 from the installer in mysql-5.0.20-win32.zip at http://dev.mysql.com/downloads/mysql/5.0.html (and administrator 1.1.9 and query browser 1.1.20). I installed PHP 5.1.2 from the installer...
3
2474
by: news | last post by:
Hi all, hope you can help me. I have recently set up a mysql database of local pubs, with a web form to add new listings (using PHP to generate an INSERT query). I've just been doing a bit of data entry, adding a bunch of new pubs, and all was going swimmingly. But suddenly it has stopped working - now when I try to add a new pub I get an error message "call to undefined function". I have not altered the script in any way since the...
11
2743
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other problems? Of course, I presume that inside f I don't access i in case it was called via g. int f(int i){ /* ... */ return 0; }
2
6313
by: salvadorvp | last post by:
Hi, I have the following code that gives me this odd error message at a line of code inside the PEAR libraries: "Fatal error: Call to undefined function: MDB2_Driver_mssql::getMessage(). in C:\php\PEAR\lib\MDB2.php on line 1921" My code is a simple submit processing form for a login page: <?php
9
3277
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this function are of type int. (My question has nothing to do with the definition of the function foo, so don't bother about it.) If I call the function as: foo(2,3,4,5,6,7,8);/*More arguments than expected*/
7
3405
by: lumo2000 | last post by:
hello i am not able to get mysql running. you can get my server/php settings/details here: http://damn-i-have.no-ip.com/phpinfo.php i already enabled the following stuff in my php.ini NOTE: i installed php to C:\php and got the ext dir in the install dir. extension_dir = "C:\php\ext"
9
2380
by: Yannick | last post by:
Hi everyone - I am not quite sure to understand what is really going on when a function defined in one translation unit calls a function defined in a different translation unit without knowing its prototype. Let's say for instance : foo.c #include <stdio.h>
1
6474
by: Beamor | last post by:
function art_menu_xml_parcer($content, $showSubMenus) { $doc = new DOMDocument(); $doc->loadXML($content);//this is the line in question $parent = $doc->documentElement; $elements = $parent->childNodes; need help. my site worked fine on my localhost but when i uploaded it to my live server i keep getting this error need help to recode line to match my hosting server. im using php 5 i have attached the common_method file
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10370
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.