error msg understanding

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dumb
Forum Newbie
Posts: 1
Joined: Sat Mar 18, 2006 12:05 am

error msg understanding

Post by dumb »

i am php beginner. I had debug a php coding using some editor and an error msg appear, i confuse and dont understand the meaning of the error msg. The error msg as below:

call to undefined function and call to a member function on a non_object

i had reconfigure the apache and yet the error still appear....

TQ
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it would help to know which function it said was undefined and what the "non-object" was.. maybe you should post your code.
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

This usually encounters when you call a non defined function. For example if you declared a function in another file and you didn't include the file in the current one, where you are calling it you will get this kind of error. Also you should check if there wasn't a typing mistake and you wrote a wrong name.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

undefined function - either you're trying to use a PHP function that's part of a newer version than the PHP you're currently running, you don't have the correct extensions enabled, or you're trying to use a function that you made without declaring it first

for example

Code: Select all

echo my_function("hi");
would spit out an error, whereas this would not

Code: Select all

function my_function($text){
   return $text;
}

echo my_function("hi");
The call to a member function on a non-object means that you're trying to use a function that was inside of a class without first instantiating the object.

You're probably doing something like this

Code: Select all

echo $class->doFunction($data);
where it should really look like this

Code: Select all

require 'class.php';
$class = new class();

echo $class->doFunction($data);
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply