KoolReport's Forum

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

Call to a member function execute() on boolean #2183

Open Oya Kaynar opened this topic on on Jul 6, 2021 - 7 comments

Oya Kaynar commented on Jul 6, 2021

This error is received when the report is called after the criteria are entered. Then, when the Get report button is pressed several times, the report appears. How can this problem be solved? . Can you help please?

Sebastian Morales commented on Jul 6, 2021

Print out your sql queries and params (if they exist), then copy and paste them to your database admin interface to see if they work. Rgds,

Oya Kaynar commented on Jul 6, 2021

thank you so much. we did this. Query works fine on db

Sebastian Morales commented on Jul 7, 2021

Pls post your report setup code and the output sql query. Tks,

Oya Kaynar commented on Jul 7, 2021
select
                    BM.CODE                                                                AS CODE,
                    XU.FULLNAME                                                                 AS CALLERNAME,
                    FMSB.NAME                                                                   AS BINA,
                    F.NAME                                                                      AS KAT,
                    W.NAME                                                                      AS KANAT,
                    FMS.LOCATIONCODE                                                               AS LOCATIONCODE,
                    FMS.BUSINESS_NAME                                                               AS LOCATIONNAME,
                    date_format(BM.IDATE, '%d/%m/%Y %H:%i:%s')                               AS IDATE,
                    date_format(BM.PLANNEDDATE, '%d/%m/%Y %H:%i:%s')                         AS PLANNEDDATE,
                    BMSL.ITEMREF                                                             AS PERFORMANCE_PARAM,
                    BMSL.CATEGORYCODE                                                        AS CATEGORYCODE,
                    IF(EK18.ISTENEN_SEC = '', 'Tanımlı Değil', formatTime(EK18.ISTENEN_SEC))       AS YANITLAMA,
                    IF(EK18.D_ISTENEN_SEC = '', 'Tanımlı Değil', formatTime(EK18.D_ISTENEN_SEC)) AS DUZELTME,
                    date_format(BM.TDATE, '%d/%m/%Y %H:%i:%s')                        AS TDATE,
                    date_format(BM.TARGET_FDATE, '%d/%m/%Y %H:%i:%s')                        AS TARGET_FDATE,
                    X1.DISPVALUE                                                             AS ISSUE_STATUSNAME,
                    date_format(responded.IDATE, '%d/%m/%Y %H:%i:%s')                             AS YANITLAMA_ZAMANI,
                    date_format(fixed.IDATE, '%d/%m/%Y %H:%i:%s')                                 AS DUZELTME_ZAMANI,
                    date_format(BM.UDATE , '%d/%m/%Y %H:%i:%s')                                 AS UDATE,
                    if(EK18.ISMTBKT = '1', 'Var', 'Yok')                            AS MUTABAKAT,
                    EK18.THP                                                                 AS HATA_PUANI,
                    CAST( EK18.HIZMET_KO   AS DECIMAL(12,6))                                      AS KESINTI_ORANI
                    FROM Z_EK18 EK18
                   LEFT OUTER JOIN BM ON EK18.HCODE = BM.CODE
                     LEFT OUTER JOIN XUSER XU ON BM.CALLERCODE = XU.CODE
                    LEFT OUTER JOIN CMPNY C ON XU.CMPNY = C.CODE
                    INNER JOIN BMSTATUS
                                 ON BM.ISSUESTATUS = BMSTATUS.CODE AND BMSTATUS.TYPE = 'ISSUE' AND
                                    BMSTATUS.LANG = '0' and BMSTATUS.PARENTCODE!='Open'
                    LEFT OUTER JOIN BMSL ON BM.SLACODE = BMSL.CODE
                    LEFT OUTER JOIN bmactivities responded
                         ON responded.MODULECODE = BM.CODE AND responded.NEWSTATUS = 'Responded' AND
                            responded.EXSTATUS IN ('WIP', 'Open')
                    LEFT OUTER JOIN bmactivities fixed ON fixed.MODULECODE = BM.CODE AND fixed.NEWSTATUS = 'Fixed' AND
                                               fixed.EXSTATUS IN ('Durum28', 'DRM00002', 'Responded')
                    LEFT OUTER JOIN AAAA FMS ON FMS.LOCATIONCODE = BM.LOCATIONCODE
                    LEFT OUTER JOIN AAAA_BFW FMSB ON FMSB.CODE = FMS.BUILDINGCODE
                    LEFT OUTER JOIN AAAA_BFW F ON F.CODE = FMS.FLOORCODE
                    LEFT OUTER JOIN AAAA_BFW W ON W.CODE = FMS.WINGCODE
                    LEFT OUTER JOIN xdropboxes X1 on X1.REALVALUE=BMSTATUS.CODE   and X1.UNIQUEVALUE='stissue_status'
        WHERE 1=1  AND  EK18.SERVICE_CODE  = '1' AND FMSB.CODE  in ('BU0001')  AND F.CODE  in ('FL00001')    AND BMSTATUS.PARENTCODE   in ('Close')  AND BMSTATUS.CODE ='Closed' AND EK18.PERIOD = '202106' AND (EK18.THP > '0' OR EK18.HHP > '0')
        GROUP BY EK18.HCODE
        ORDER BY EK18.ID DESC

When this error is received, the sql has been checked. The reason for the error is that it cannot connect to the mysql object. During the mysql execute process, it enters the catch block and gives an error.


Setup Code:;

<?php
/**
 * Created by PhpStorm.
 * User: *********
 * Date: 25.03.2019
 * Time: 17:44
 */

namespace koolreport;


abstract class *******KoolReport extends KoolReport
{
    const DATASOURCE_******* = "*******";
    protected $query;
    protected $reportName;

    public function __construct($reportName, $params = array())
    {
        $this->reportName = $reportName;
        parent::__construct($params);
    }

    protected function settings()
    {
        return array(
            "dataSources"=>array(
                self::DATASOURCE_*******=>array(
                    'host' => GP('............'),
                    'username' => GP('.............'),
                    'password' => GP('.................'),
                    'dbname' => GP('...........'),
                    'charset' => 'utf8',
                    'class' => "\koolreport\datasources\MySQLDataSource"
                ),
            )
        );
    }

    /**
     * @return \koolreport\datasources\PdoDataSource DataSource
     * @throws \Exception
     */
    public function getDataSource(){
        return $this->src(self::DATASOURCE_*******);
    }

    protected function OnBeforeSetup(){
        if (!isNullOrEmpty($this->reportName) && method_exists($this, $this->reportName)) {
            call_user_func(array($this, $this->reportName));
            return true;
        }
        return false;
    }

    /**
     * Calls reportName's Setup function
     * @return void|null
     */
    protected function setup()
    {
        call_user_func(array($this, $this->reportName."Setup"));
    }

}
Sebastian Morales commented on Jul 8, 2021

Pls try to create a mysqli connection with your datasource information using this command:

<?php
$connection = new \mysqli($host, $username, $password, $dbname);
var_dump($connection)

Pls check that $connection is created successfully. Then fill in the host, username, password and dbname information back to your report's datasource setting. Rgds,

Oya Kaynar commented on Jul 8, 2021

Hello, After the necessary check, the error has been fixed. But the data is loading too slowly. Do you have a solution for this issue? Thanks in advance

Sebastian Morales commented on Jul 8, 2021

How large is the data that your sql query returns?

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
None yet

Export