Hey, thanks a lot it works now...
Oh my god... I'm laughing right now...
It solved the MVC problem, but I still can't get the query run...
I tried it with different approach by now:
MODEL:
PHP Code:
<?php class Dash_model extends CI_Model {
public function __construct()
{
// Call the CI_Model constructor
parent::__construct();
$this->load->database();
}
public function testtotal()
{
$this->db->select('transaction_id');
$this->db->from('dbo.transaction_table'); // I'm using MS SQL Server
$where = "transaction_id='5' OR transaction_id='4'";
$this->db->where($where);
return $this->db->count_all_results();
}
}
?>
CONTROLLER:
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Dash_control extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function index()
{
$this->load->model('dash_model');
$data['testing']=$this->dash_model->testtotal();
$this->load->view('dashboard',$data);
}
}
VIEW: (I'm using a Bootstrap HTML5 Template's table, so I put the count result in one of the <td>)
PHP Code:
<thead>
<tr>
<th>Bank Name</th>
<th>Total Transaction</th>
</tr>
</thead>
<tr>
<td>Lovely Bank</td>
<td><?php echo $testing; ?> </td>
</tr>
Still no count result showing... The error I got was:
PHP Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: testing
Filename: views/dashboard.php
Line Number: 147
Backtrace:
File: C:\xampp\htdocs\application\views\dashboard.php
Line: 147
Function: _error_handler
File: C:\xampp\htdocs\application\controllers\Welcome.php
Line: 19
Function: view
File: C:\xampp\htdocs\index.php
Line: 292
Function: require_once
Thank you for your help, guys... I really appreciate it...