hi
can anybody tell what the error is

Fatal error: Call to a member function insertseeks() on a non-object

in php

I have just resolved a much simular error myself a few minutes ago and turned out the container was not assigned to the variable properly. An example is the following script:

$container_variable = new object();
$container_variable->function();

So that above example is when everything is working. But say the following happened:

$container_variable = new object();
function test() {
$container_variable->function();
}
test();

The above function will not work because the container variable is now isolated in the function where only global variables can be taken into the function. So my point is, this error generally occurs when the container variable is somehow unset or changed. So make sure that the container is a valid object throughout the script.

thanks for ur reply now i can understand ..........
can u tell how to make it valid

<?
session_start();
	require_once('../common/dblayer.php');
	require_once('../common/converters.php');
	$db=new dblayer();

	if (isset($_REQUEST["fname"]) and strlen($_REQUEST["fname"]) > 0)  {
		insert_user();
		$seeker_id=$_SESSION["seekerid"];
	} 
	function insert_user() {

		$fname=$_REQUEST["fname"];
		$lname=$_REQUEST["lname"];
		$user=$_REQUEST["username"];
		$pss=$_REQUEST["password"];
		$result1=$db->insertseeks($user,$pss);
		$res1=$db->insertseek2($user,$pss);

}

my error is

Fatal error: Call to a member function insertseeks() on a non-object in

Does the session seekerid actually exist? Are you trying to select a session that hasn't been created yet.

Dunno what my first post was about I think my brain left me for a minute...

cwarn23 was on the right track with his reply

Is there any reason you can't just include the

$fname=$_REQUEST["fname"];
		$lname=$_REQUEST["lname"];
		$user=$_REQUEST["username"];
		$pss=$_REQUEST["password"];
		$result1=$db->insertseeks($user,$pss);
		$res1=$db->insertseek2($user,$pss);

within the if isset statement or is it used elsewhere?

you use global inside the function

function blah() {
 global $db;
  //code here
}

or send the object as a parameter

function blah( &$db ) {
  //code here
}

I have no idea why you want this as a function. It doesn't need to be.

This question has already been answered. Start a new discussion instead.