KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Undefined property: MyReport::$run #918

Open Sowmya opened this topic on on Jun 11 - 2 comments

Sowmya commented on Jun 11

Hi, I'm Sowmya. In my project I want to generate Koolreports using SqlServer and Codeigniter3.... I followed same as your tutorial, But I'm facing some problems. Here attached my code and Output messages. Please give me the solution as early as possible....

Sowmya commented on Jun 11

Hi, I'm Sowmya. In my project I want to generate Koolreports using SqlServer and Codeigniter3.... I followed same as your tutorial, But I'm facing some problems. Here attached my code and Output messages. Please give me the solution as early as possible....

Welcome.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

require APPPATH."/reports/MyReport.php";

class Welcome extends CI_Controller {

	public function index()
	{
		//$this->load->view('welcome_message');
		$report = new MyReport();
		$report->run->render();
	}
}

MyReport.php:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');


require APPPATH."/libraries/koolreport/core/autoload.php";


class MyReport extends \koolreport\KoolReport
{
	//use \koolreport\codeigniter\Friendship;
	use \koolreport\clients\Bootstrap;

	function settings()
	{
		return array(
			"assets" => array(
				"path"=>"../../assets",
				"url"=>"assets",),
			"dataSources"=>array(
				"icsoft"=>array(
					"connectionString"=>"sqlsrv:server=localhost ; Database=dbName",
					"username" => "username",
					"password" => "password",
					"charset" => "utf8"
				)
			)
		);
	}
	function setup()
	{
		$this->src('icsoft')
		->query("select * from Stock")
		->pipe($this->dataStore("Stock"));
	}
}

__MyReport.view.php:__

<?php

use \koolreport\widgets\koolphp\Table;

?>

<html lang="en">
  <head>
    
    <title>MyReport</title>
  </head>
  <body>
    <h1>MyReport</h1>

    <?php
    	Table::create(array(
    		"dataStore"=>$this->dataStore("Stock"),
    		"class"=>array(
    			"table"=>"table table-hover")
    	));

    ?>
	</body>
</html>

My Error Message:

VA PHP Error was encountered
Severity: Notice

Message: Undefined property: MyReport::$run

Filename: controllers/Welcome.php

Line Number: 27

Backtrace:

File: C:\xampp\htdocs\CI3\application\controllers\Welcome.php
Line: 27
Function: _error_handler

File: C:\xampp\htdocs\CI3\index.php
Line: 315
Function: require_once

An uncaught Exception was encountered
Type: Error

Message: Call to a member function render() on null

Filename: C:\xampp\htdocs\CI3\application\controllers\Welcome.php

Line Number: 27

Backtrace:

File: C:\xampp\htdocs\CI3\index.php
Line: 315
Function: require_once
KoolReport commented on Jun 11

It is not

$report->run->render();

but

$report->run()->render();

Give tips to supporter for his good work

If you feel that supporter has done a good work, consider giving him some credit. Any amount put into the tips box below is appreciated. By doing so, you have contribtuted to the existence of KoolReport and the quality of support.

Tips box
help needed

CodeIgniter