Export to Excel

Topics: Developer Forum
Jul 27, 2015 at 8:05 AM
Edited Jul 27, 2015 at 8:50 AM
I would like to export to excel and show the names of some foreign keys in the excel sheet export table.

       $query = "SELECT `serial_no`, `req_date`, `program_name`, `program_duration`, `role_covered`, `role_holders_no`, `opco_name`, `client_spoc_name`, `client_spoc_email`, `client_spoc_tel`, `program_objective`, `program_outcome`, `topics_to_cover`,`CR_assigned`, `CR_assigned`,`assigned_date`,`CR_status` FROM content_requests WHERE request_status='Approved' AND assigned_status='Assigned' ORDER by serial_no DESC"; 
        $headings = array('Serial No','Request Date','Program Name','Duration','Role covered','Role Holders no','Opco Name','Client', 'Client Email','Client Tel','Program Objective','Program Outcome','Topics to cover','CR assigned','Assigned date','CR status'); 

in this table i have CR_assigned which is the user ID and i will like to display username in the excel sheet instead of ID that is by referencing to the users table and picking their name?
i have this query
       $CR_results = $db->selectData("users"," id = $CR_assigned");

         foreach ($CR_results as $urows) 

              $user_id = $urows['id'];
              $CR_assigned = $urows['firstname']."\t". $urows['lastname'];
how to integrate is the my problem
Jul 28, 2015 at 12:39 PM
I got the solution it all about joining the tables in the sql statements
Marked as answer by Koechben on 7/28/2015 at 5:40 AM