I'm trying to pull two columns as an array using a technique that has worked for me in other places so far. But it is only returning the first column's values with empty values for the second column.
Here's my controller
function status()
{
$this -> load -> model('model');
$data['query'] = $this -> model -> checkWebStatus('database');
if ($this -> uri -> segment(3) == '')
{
$this -> template -> set_content('status_view', $data);
$this -> template -> build();
}
}
The model looks like this:
function checkWebStatus($database)
{
$this -> external_db = $this -> load -> database($database, TRUE);
$query = $this -> external_db -> select('name_code, active_franchise');
$query = $this -> external_db -> order_by('active_franchise DESC, name_code ASC');
$query = $this -> external_db -> get('database_table');
return($query -> result());
}
And my view looks like this...
foreach ($query as $result)
{
echo $result -> name_code;
print ' ';
echo (isset($result -> active_franchise)) ? $result -> active_franchise : 'var unset';
print '<br />';
}
I end up with an array of name_code(s) and accompanying "var unset" messages. Any advice? As I said this system has worked fine before with different names for the columns, the only difference being this database is explicitly set in the model whereas the area it appears to work on is on the default "db" through Codeigniter.
I appreciate your time reading this, thank you.
---EDIT---
Crap I suck, can't believe I missed the typo. BUT. It did not solve the issue. Now instead of showing "var unset" it simply lists no value at all. It should return either a 1 or 0.
---EDIT 2---
var_dump($result) returns....
object(stdClass)#24 (2) { ["name_code"]=> string(6) "GECAOC" ["active_franchise"]=> string(1) "" } GECAOC
object(stdClass)#25 (2) { ["name_code"]=> string(6) "GEPACT" ["active_franchise"]=> string(1) "" } GEPACT
object(stdClass)#26 (2) { ["name_code"]=> string(6) "GEWAES" ["active_franchise"]=> string(1) "" } GEWAES