KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Undefined property: MyReport::$run #918

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

Sowmya commented on Jun 11, 2019

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, 2019

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, 2019

It is not

$report->run->render();

but

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

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

CodeIgniter