Fatal error: Call to undefined function: db_fetch_array()

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
joey85
Forum Newbie
Posts: 3
Joined: Mon Mar 14, 2005 5:41 am

Fatal error: Call to undefined function: db_fetch_array()

Post by joey85 »

Hi

does anyone know why i would be getting this?

Fatal error: Call to undefined function: db_fetch_array()

i am connected to the database :?

Thanks
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

There's no such function in any version of PHP.

Do you mean mysql_fetch_array() ?? :?

http://www.php.net/mysql_fetch_array

Use PHP.net for all function lists and usages...
joey85
Forum Newbie
Posts: 3
Joined: Mon Mar 14, 2005 5:41 am

Post by joey85 »

Yeh, but it is defined in a separate file.

Code: Select all

//dblib.php
function db_fetch_array($query) {
     return mysql_fetch_array($query);
}

//config.php
require(&quote;$CONFIG->libdir/dblib.php&quote;);
Having a few other probs with other functions that have been defined but it keeps saying they havent. Should i be using include instead of require maybe??
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Code: Select all

function db_fetch_array($query) {
     return mysql_fetch_array($query);
}
This functions seems incredibly wasteful... all it does is passes it to a pre-defined function... why not just make do with mysql_ftech_array() instead of adding extra code?

You should use either require or include (they just handle slightly differently) but are you actually including the file that contains this function on the page that you're trying to use this function on?
joey85
Forum Newbie
Posts: 3
Joined: Mon Mar 14, 2005 5:41 am

Post by joey85 »

Yeh it is wasteful but i didnt program it to start with, i got it off of someone and trying to install it.

i will change them and see if it makes a difference.

But yeh, it is included before it is used. The file that first uses it is itself included.

Kinda like this: where the first call to db_fetch_array is in general.php.

Code: Select all

//dblib.php
function db_fetch_array($query)  {
    return mysql_fetch_array($query);
}

 //config.php
require(&quote;$CONFIG->libdir/dblib.php&quote;);
require(&quote;$CONFIG->libdir/general.php&quote;);
so it should be including it before its used.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It's an OO concept. It allows the underlaying code to change without changing the calling interface. Although normally, it'd be a method in a class..
Post Reply