From c99d1d576d0de61ea101fc0fa52248ae9e26fbb8 Mon Sep 17 00:00:00 2001 From: dev-chiefworks Date: Wed, 13 Apr 2022 21:05:03 -0400 Subject: [PATCH] fix --- app/Config/Database.php | 20 ++++++++++++++++++++ app/Controllers/Home.php | 36 ++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/app/Config/Database.php b/app/Config/Database.php index 1e63408..de11e92 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -30,6 +30,26 @@ class Database extends Config * * @var array */ + public $db = [ + 'DSN' => '', + 'hostname' => '10.10.33.21', + 'username' => 'savvy', + 'password' => 'savvy001!', + 'database' => 'savvy', + 'DBDriver' => 'postgre', + 'DBPrefix' => '', + 'pConnect' => false, + 'DBDebug' => (ENVIRONMENT !== 'production'), + 'charset' => 'utf8', + 'DBCollat' => 'utf8_general_ci', + 'swapPre' => '', + 'encrypt' => false, + 'compress' => false, + 'strictOn' => false, + 'failover' => [], + 'port' => 5432, + ]; + public $default = [ 'DSN' => '', 'hostname' => 'localhost', diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index b7f0942..aec14d1 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -6,25 +6,25 @@ class Home extends BaseController { public function index() { - $endpoints = array( - 'getdrycleanservicelist' => array('POST'), - 'createuser' => array('POST'), - 'userlogin' => array('POST'), - 'updateprofile' => array('POST'), - 'updsprofile' => array('POST'), - 'newlundrypickup' => array('POST'), - 'newdrycleanpickup' => array('POST'), - 'confirmlundrypickup' => array('POST'), - 'savecardpayment' => array('POST'), - 'getlundrylocation' => array('POST'), - 'getcardpaymentlist' => array('POST'), - 'getmyservicelist' => array('POST'), - 'getoneserviceitem' => array('POST'), - 'loadprofile' => array('POST'), - 'deletecard' => array('POST') - ); + $db = \Config\Database::connect('db'); - $data['endpoints'] = $endpoints; + $query = $db->query('SELECT id, bank_name FROM banks'); + $results = $query->getResult(); + + foreach ($results as $row) { + echo $row->id; + echo $row->bank_name; + } + + echo 'Total Results: ' . count($results); + + + $query = $this->db->get('banks'); + $results = array(); + foreach ($query->result() as $result) { + $results[] = $result; + } + var_dump( $results ); return view('welcome_message',$data); } }