[eluser]Unknown[/eluser]
I am new to CI and doing my first project on my local machine using WAMP.
The results displayed on my view page show only the first letter of the result value.
Can anyone explain why the whole value is not showing up?
The result of my view shows this:
Code:
Array ( [result] => Array ( [shipping_id] => 8 [shipping_name] => Priority Mail [shipping_alias] => PRTM [shipping_default] => 0 ) [title] => Test Title )
Test Title
You returned:
8
P
P
0
The view code looks like this:
Code:
<body>
<h1><?php echo $title; ?></h1>
You returned:
<?php foreach ($result as $key =>$res){ ?>
<h3><?php echo $res['shipping_id'] ?></h3>
<br/>
<?php } ?>
<div id="ordersList"></div>
</body>
This is what my controller look s like:
Code:
class Orders extends Controller {
function Orders()
{
parent::Controller();
}
function index()
{
$this->load->model('orders_model');
$data['result'] = $this->orders_model->getTestData();
$data['title'] = 'Test Title';
print_r($data);
$this->load->view('orders_view',$data);
}
}
This is what my model looks like:
Code:
class Orders_model extends Model{
function Orders_model(){
parent::Model();
}
function getTestData(){
$data = array();
$q = $this->db->get('shipping');
if($q->num_rows() > 0){
$data = $q->row_array();
}
$q->free_result();
return $data;
}
}