I am writing an application in CodeIgniter where I specify the
meta-tag on every page in every controller which I have managed to send to my header te
In your model - don't return $query->result()
, just return $query
:
function get_card($card = FALSE)
{
$query = $this->db->get_where('creditcards', array('slug' => $card), 0,1);
return $query;
}
Controller:
public function show($card = NULL)
{
// verify that you got something back from the database
// or show an error
if( ! $query = $this->Listing_model->get_card($card) )
{
$this->_showNoResultsFor($card) ;
}
else
{
// get one record from the query using row()
$onecard = $query->row() ;
// assign the title using whatever your field name is called
$header["page_title"] = $onecard->thetitle ;
// Now assign the query result() to data
$data['query'] = $query->result() ;
$this->load->view('includes/header',$header);
$this->load->view('listings/listing_card',$data);
$this->load->view('includes/footer');
}
}