Welcome Guest, Not a member yet? Register   Sign In
View is showing only first letter of the result value
#1

[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>&lt;?php echo $title; ?&gt;</h1>
You returned:
&lt;?php foreach ($result as $key =>$res){ ?&gt;
    <h3>&lt;?php echo $res['shipping_id'] ?&gt;</h3>
    <br/>
&lt;?php }  ?&gt;
<div id="ordersList"></div>


&lt;/body&gt;

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;
    }
}


Messages In This Thread
View is showing only first letter of the result value - by El Forum - 04-17-2010, 03:36 PM
View is showing only first letter of the result value - by El Forum - 04-17-2010, 08:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB