[eluser]bigmac90[/eluser]
Hey
Thanks for the quick reply. At the moment I have two databases configured in CodeIgniter. One database is on WAMP and the second database is stored on another server and has all the relevant and needed keys, etc.
I actually have four queries to retrieve data and populate that data into a dropdown list in my view page.
My Controller Page looks like:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Site extends CI_Controller {
function __construct() {
parent::__construct();
$this->is_logged_in();
}
// Make sure the user is logged in
function is_logged_in() {
$is_logged_in = $this->session->userdata('is_logged_in');
if (!isset($is_logged_in) || $is_logged_in != true) {
echo "You don't have permission to access this page";
echo "<br>";
echo "<a href = 'http://localhost/ProjectSage'>Click Here to Log In</a>";
die();
}
}
function members_area() {
// Load the model get_clients_model and run function
$this->load->model('get_clients_model');
$data['clients'] = $this->get_clients_model->get_clients();
// Get array from status_array function
$data['status'] = $this->status_array();
$this->load->model('get_type_model');
$data['type'] = $this->get_type_model->get_types();
$this->load->model('get_supplier_model');
$data['supplier'] = $this->get_supplier_model->get_suppliers();
// Load the view and pass $data to that view
$this->load->view('members_area', $data);
}
function status_array() {
$status_array = array (
'assigned' => 'Assigned',
'approved' => 'Approved',
'held' => 'Held',
'rejected' => 'Rejected'
);
return $status_array;
}
}
One of my models retrieving the data:
Code:
<?php
class Get_supplier_model extends CI_Model {
function get_suppliers() {
$otherdb = $this->load->database('otherdb', TRUE);
$otherdb->select('SupplierID, SName');
$query = $otherdb->get('Supplier');
if ($query->result()) {
foreach ($query->result() as $supplier) {
$finalResult[$supplier->SupplierID] = $supplier->SName;
}
return $finalResult;
} else {
return FALSE;
}
}
}
?>
My View code looks like:
Code:
<!doctype html>
<html>
<head>
<title>ONESG - OneInvoice Exporter</title>
<!-- CSS/LESS Code Links -->
<link rel = "stylesheet" type = "text/css" href = "<?php echo base_url();?>css/site_style.css"/>
</head>
<body>
<div class = "login_wrapper">
<img class = "onesg_logo" src = "<?php echo base_url();?>img/ONESGLOGO.png"/>
<div class = "top_form">
<p>Filter By:</p>
<?php
echo form_open();
echo form_label('Client:', 'client');
echo form_dropdown('clients', $clients, '', 'id = "client"');
echo form_label('Site:', 'site');
echo form_dropdown();
echo form_label('Status:', 'status');
echo form_dropdown('status', $status, '', 'id = "status"');
echo form_label('Type:', 'type');
echo form_dropdown('type', $type, '', 'id = "type"');
echo "<p></p>";
echo form_label('Supplier:', 'supply');
echo form_dropdown('supplier', $supplier, '', 'id = "supplier"');
echo form_label('Reference:', 'reference');
echo form_input('reference', '', 'placeholder = "Enter Reference"');
echo "<p>Filter invoice by date:</p>";
echo form_label('To:', 'to');
echo form_input();
echo form_label('From:', 'from');
echo form_input();
echo "<br>";
echo "<p>Filter invoice by approval date:</p>";
echo form_label('To:', 'to');
echo form_input();
echo form_label('From:', 'from');
echo form_input();
echo form_close();
?>
</div>
</div>
</body>
</html>
Is part of the reason why codeigniter is running slow because I'm sending to much data to the view in an array from the controller???