KoolReport's Forum

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

Errors using the Input package #723

Open JTBB opened this topic on on Mar 4, 2019 - 4 comments

JTBB commented on Mar 4, 2019

Thank you so much for the previous reply !!!!! ... I had the set up exactly as you said however, I get this error always, see below. I use it in a codeigniter application.

An uncaught Exception was encountered

Type: Exception

Message: Query Error >> [Unknown column 'RelationOrderID' in 'where clause'] >> SELECT * FROM Orders WHERE RelationOrderID = :RelationOrderID

Filename: D:\www\xxxx\application\libraries\koolreport\src\datasources\PdoDataSource.php

This is my full setup, could you please help me 1 more time?

This is my Controller:

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

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

class Xxxx extends CI_Controller {

	public function __construct()
	{
		parent::__construct();

		$this->load->database();
		$this->load->helper('url');
		$this->load->library('ion_auth');
		$this->load->library('grocery_CRUD');

	}

	public function _xxxx_output($output = null)
	{
		//$this->load->view('welcome.php',(array)$output);
	}


	public function index()
	{
		echo 'string';$this->_xxxx_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));

		$report = new MyReport(array("RelationOrderID"=>"Just The Bare Bones"));
		$report->run()->render();

	}


}

This is MyReport:

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


class MyReport extends \koolreport\KoolReport
{

    use \koolreport\inputs\Bindable;
    use \koolreport\inputs\POSTBinding;
    use \koolreport\clients\Bootstrap;





    function settings()
    {
        return array(
            "assets"=>array(
                "path"=>"../../assets",
                "url"=>"assets",
            ),
            "dataSources"=>array(
                "automaker"=>array(
                    "connectionString"=>"mysql:host=xxx;dbname=xxxx",
                    "username"=>"xxx",
                    "password"=>"xxx",
                    "charset"=>"utf8"
                )
            )
        );
    }


    function setup()
    {
       // $this->src('automaker')
       // ->query("Select OrderID, OrderRelationID from Orders WHERE OrderRelationID=:OrderRelationID")
       // ->params(array(":OrderRelationID"=>$this->params["OrderRelationID"]))
       // ->pipe($this->dataStore("Orders"));

        $this->src("automaker")->query("
            SELECT * FROM Orders
            WHERE
            RelationOrderID = :RelationOrderID
        ")
        ->params(array(
            ":RelationOrderID"=>$this->params["RelationOrderID"]
        ))
        ->pipe($this->dataStore("Orders"));

    }
}

This is MyReport.view

//MyReport.view.php
use \koolreport\inputs\DateRangePicker;
use \koolreport\widgets\koolphp\Table;
use \koolreport\inputs\Select;
?>
<html>
    <head>
        <title>MyReport</title></title>
    </head>
    <body>
        <h1>MyReport</h1>
        <h3>List all orders</h3>





        <?php
        Table::create(array(
            "dataStore"=>$this->dataStore("Orders"),
            "class"=>array(
                "table"=>"table table-hover"
            )
        ));
        ?>
    </body>
</html>
KoolReport commented on Mar 4, 2019

Please check if the column RelationOrderID is existed in your database table. Please check the sensitive case as well. From the error, it clearly states that this column is unknown or not existed. Also check the name of table in case sensitive.

You may try to test if following query ( using PHPMyAdmin for example):

SELECT * FROM Orders WHERE RelationOrderID = 'Just The Bare Bones'

If you get the same error then issue is your column name

JTBB commented on Mar 4, 2019

I did not have this before but yes I get the same error:

Message: Query Error >> [Unknown column 'RelationOrderID' in 'where clause'] >> SELECT * FROM Orders WHERE RelationOrderID = 'Just The Bare Bones'

JTBB commented on Mar 4, 2019

What a fool I am ... it is working!!! Thank you very much and I apologize for my stupidity. The problem was in this line: "connectionString"=>"mysql:host=xxx;dbname=xxxx" ... the dbname was incorrect ... so sorry ... I put all my frustration in Koolreport when all along I was wrong ...

I am starting to love this Koolreport ... well done guys ... I will now continue and buy the Pivot package!

KoolReport commented on Mar 4, 2019

Awesome! It happens all the time in developer world :D, the error happens at place where we do not think it is.

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

Inputs