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

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
NModern
Forum Newbie
Posts: 11
Joined: Fri Aug 20, 2010 2:31 am

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

Post 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?
NModern
Forum Newbie
Posts: 11
Joined: Fri Aug 20, 2010 2:31 am

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

Post by NModern »

?
NModern
Forum Newbie
Posts: 11
Joined: Fri Aug 20, 2010 2:31 am

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

Post by NModern »

nobody will help?
NModern
Forum Newbie
Posts: 11
Joined: Fri Aug 20, 2010 2:31 am

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

Post by NModern »

?
Post Reply