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

[eluser]CroNiX[/eluser]
But if there are no results, $q->result() will just be an empty array anyway, so you might as well just...

Code:
function get_tickets2()
{
  return $this->db
    ->select('ref_code, ref_desc')
    ->where('tab_code', 'APPN')
    ->get('prob_ref')
    ->result();
}
#12

[eluser]NeoArc[/eluser]
Sometimes I got warnings when using CI_DB_result::result() directly.

Apparently, CI_DB_result::result_object() should always return an array.

#13

[eluser]CroNiX[/eluser]
result() and result_array() both return an array.

result() returns an array of objects (each row of the array is a result stored as an object)
result_array() returns an array of arrays, where each row in the array is an array of the results.

For result(), you'd access the properties...

Code:
foreach($query->result() as $result)
{
  echo $result->some_column;
}
For result_array(), you'd access the array key...
Code:
foreach($query->result_array() as $result)
{
  echo $result['some_column'];
}
#14

[eluser]NeoArc[/eluser]
Yeah... let's hope iamsen47 solves his problem.
#15

[eluser]Aken[/eluser]
This is why it's important to learn the basics of a programming language. If you don't know how to access the properties of an object or array, you should take some time to focus on that first, or using CI will continue to be a chore because you don't understand what you're coding.




Theme © iAndrew 2016 - Forum software by © MyBB