Page 1 of 1

Call to a member function nssql_query() on a non-object

Posted: Fri Aug 20, 2010 2:38 am
by NModern
I have trouble with class. Plase help.

This is index.php

Code: Select all

<?php
	include("nssql/inc.php");
	nssql_connect("Z:\\home\\nssql.loc\\www\\nssql\\");
	echo nssql_query("salam");
?>
nssql/inc.php

Code: Select all

<?php
	function nssql_connect($nssql_dir){
		define("NSSQL_DIR",$nssql_dir);
		if(!file_exists(NSSQL_DIR."engine/engine.php"))die("Couldn't connect to database");
		else{
			include(NSSQL_DIR."engine/engine.php");
			include(NSSQL_DIR."engine/functions.php");
		}
	}
?>
nssql/engine/engine.php

Code: Select all

<?php
	class Nssql{
		public function nssql_query($query){
			return $query;
		}
	}
	$Nssql = new Nssql();
?>
nssql/engine/function.php

Code: Select all

<?php
	function nssql_query($query){
		global $Nssql;
		return $Nssql->nssql_query($query);
	}
?>
I am getting error

Fatal error: Call to a member function nssql_query() on a non-object in Z:\home\nssql.loc\www\nssql\engine\functions.php on line 4

what is the problem?

Re: Call to a member function nssql_query() on a non-object

Posted: Fri Aug 20, 2010 6:11 am
by NModern
?

Re: Call to a member function nssql_query() on a non-object

Posted: Fri Aug 20, 2010 9:04 am
by NModern
nobody will help?

Re: Call to a member function nssql_query() on a non-object

Posted: Sat Aug 21, 2010 3:53 am
by NModern
?