Page 1 of 1
error msg understanding
Posted: Sat Mar 18, 2006 12:19 am
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
Posted: Sat Mar 18, 2006 12:35 am
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.
Posted: Mon Mar 20, 2006 1:29 am
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.
Posted: Mon Mar 20, 2006 4:20 am
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
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
where it should really look like this
Code: Select all
require 'class.php';
$class = new class();
echo $class->doFunction($data);