KoolReport's Forum

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

Datasource in Mysql #819

Open Keerthiga opened this topic on on Apr 19, 2019 - 4 comments

Keerthiga commented on Apr 19, 2019

Hi Team, If there is any possible way to adding database connection by using include('connection.php') method in dataSources instead of adding every files. Because, when files moved into live, i have 10 files then i need to change database connection of every files . i have used codeIgniter plugin for report making.Please give any suggestion. Thanks .

KoolReport commented on Apr 19, 2019
Keith Burke commented on Apr 19, 2019

Here is my settings function for most of my reports, unless they need some other stuff

    public function settings()
    {
        $config = include "../../includes/config.php";
        return array(
            "dataSources"=>array(
                "query_source"=>$config["query_source"]
            )
        );       
    }

And my config.php file.

<?php
return array(
            "query_source"=>array(
                "host"=>"1.2.3.4.",
                "dbname"=>"myDb",
                "username"=>"myUser",
                "password"=>"myPassword",
                "charset"=>"utf8",
                "class" => "\koolreport\datasources\MySQLDataSource",
                "smtpHost" => "smtp.office365.com",
                "smtpPort" => 587,
                "smtpSecure" => "tls",
                "smtpAuth" => true,
                "smtpUsername" => "email@mydomain.com",
                "smtpPassword" => "MyEmailPassword"
            )
        );
Keith Burke commented on Apr 19, 2019

Sorry, I didn't see the CodeIgnitor part. Unless there is a better wiay in CI, my way means only updating the config.php connection strings once per move.

Keerthiga commented on Apr 19, 2019

Thanks a lot !!

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

CodeIgniter