Welcome Guest, Not a member yet? Register   Sign In
Problem with creating CSV file
#1

[eluser]condoace[/eluser]
I need to create a CSV file and want the colums to represent data from table_1 and rows to represent data from table_2.

I am using code below, but it only exports from table_1:

How do I change the code to be able to have colums from a second table?? I am presuming some sort of JOIN but not sure.. and not sure how it would work with the csv_from_result() function.


Code:
function export_surveys(){
  
   $this->load->helper('download');
  
   $this->load->dbutil();
  
   $q = "SELECT id, job_title, job_description,job_locatio FROM table_1 ORDER BY id DESC";
  
   $result = $this->db->query($q);
  
   return $this->dbutil->csv_from_result($result, ",", "\n");
  
  }




Theme © iAndrew 2016 - Forum software by © MyBB