For some reason I am unable to use query results in the same function that calls them. Please see controller below and model and let me know where my issue is.
What breaks down is line 2 of controller, trying to concatenate query result contact_name and description_computer and saving it as variable name. I get the following error “Undefined variable: query” for both query results.
Using codeigniter.
Controller
function get_quarter_info($data)
{
$data['query'] = $this->model->get_client_info($data);
$data['name'] = $query['contact_name'] . " " . $query['description_computer'] . ".pdf";
$html = $this->load->view('Quarter_info_view', $data, true);
$pdf = pdf_create($html, '', false);
write_file($data['name'], $pdf);
$this->index();
}
Model
function get_client_info($data)
{
$query = $this->db->get_where('subscriber_report', array('client_number'=> $data['client_number']));
return $query->row_array();
}
You’re not assigning a value to
$queryinget_quater_info. Instead, you’re assigning the value to $data[‘query’];Try this instead: