Welcome Guest, Not a member yet? Register   Sign In
result_array() turns nothing but 'array' text.
#1

[eluser]iamsen47[/eluser]
Solution here.
http://ellislab.com/forums/viewthread/223400/#1026697

Explaination?
maybe when I figure it out.


I'm trying to load some data from this table called 'prob_ref', from this col called 'ref_code' where the 'tab_code' col's value is 'APPN'. There are 5 such rows out of 73 rows.

All I get is 73 lines of the word 'Array'.

row() and row_array() returns the top most row while result() returns a "Message: Object of class stdClass could not be converted to string" error.

What am I doing wrong?

This data will eventually be used to fill out options in a dropdown menu, with the corresponding 'tab_code' for the corresponding dropdown. But I can't get anything to work. Eventually, ref_code will be the option value while ref_desc will be the option text.

model
Code:
function get_tickets($tab = FALSE)
{
  if($tab === FALSE)
  {
   $q = $this->db->select('ref_code')
        ->from('prob_ref')
        ->where('tab_code',$tab);
   return $q->get()->result_array();
  }
}

controller
Code:
public function index()
{
  $tab='APPN';
  $data['form'] = $this->form_model->get_tickets();
  
  $this->load->view('form/index', $data);

}

view
Code:
<?php foreach ($form as $form_item): ?>

&lt;?php echo $form_item?&gt;<br>

&lt;?php endforeach ?&gt;


Messages In This Thread
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 02:31 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 02:48 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 02:52 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 03:19 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 03:32 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 03:39 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 03:43 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 04:33 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 06:00 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 07:49 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 09:23 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 09:51 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 09:57 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 10:00 AM
result_array() turns nothing but 'array' text. - by El Forum - 08-29-2012, 11:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB