I have a trouble with my script. Everytime I execute index.php, and call add_schedule, always appear message:
Fatal error: Call to a member function add_schedule_form() on a non-object in index.php on line 19.
I have try to fix by changing the syntax on line 19 (index.php) but it just was the same.
Can anybody help me to solve this problem? My programming is not so good, but I like programming.
I am trying to develop a reservation system for my final thesis.

// file: system_class.php
	class system_class {
		var $mysql;
		var $err_msg;
		var $message;

		function system_class()
		{	// variable for error message
			global $text;
			$this->mysql=new mysql_manager('');

		function add_schedule_form() {
			return $output;
// file: index.php
	ob_start() ;
	$d = dirname(__FILE__); 
	include $d.'/syst/system_class.php';

	function index() {
		print(“<a href=\”index.php?action=add_schedule\”>add schedule</a>”);

	function add_schedule() {
		global $login;
		echo $login->add_schedule_form(); 
	switch ($action) {
		case "add_schedule": add_schedule(); break;
		//load the default function.
		Default: index(); Break;


you should create object of class system_class.
then only all function of that class can be used.

Member Avatar for rajarajan2017

You can solve the issue by creating the object like below in your index.php

function add_schedule() {
 $obj = new $login;
 echo $obj->add_schedule_form(); 

It will work!

Hi, it's work! ^^ .. Thanks a lot

Member Avatar for rajarajan2017

Please Mark the thread as solved! If it is solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.