Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8935423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:58:42+00:00 2026-06-15T09:58:42+00:00

This is my query: $this->db->select(‘e.emp_no’, ‘e.birth_date’, ‘e.first_name’, ‘e.last_name’, ‘e.gender’, ‘e.hire_date’) ->from(’employees AS e’) ->join(‘titles

  • 0

This is my query:

$this->db->select('e.emp_no', 'e.birth_date', 'e.first_name', 'e.last_name', 'e.gender', 'e.hire_date')
            ->from('employees AS e')
            ->join('titles AS t', 'e.emp_no = t.emp_no')
            ->join('salaries AS s', 't.emp_no = s.emp_no')
            ->join('dept_emp AS de', 's.emp_no = de.emp_no')
            ->join('departments AS d', 'de.dept_no = d.dept_no')
            ->join('dept_manager AS dm', 'd.dept_no = dm.dept_no')
            ->limit($limit, $offset)
            ->order_by($sort_by, $sort_order)
            ->group_by('e.emp_no')
            ->where('t.title', 'staff'); 

I then return the array with this:

$ret['rows'] = $q->get()->result();

        print_r ($ret['rows']);

All that is outputted is the emp_no:

Array ( [0] => stdClass Object ( [emp_no] => 10002 ) [1] => stdClass Object ( [emp_no] => 10005 ) [2] => stdClass Object ( [emp_no] => 10007 ) [3] => stdClass Object ( [emp_no] => 10011 ) )

How do I get to output all the selected columns?

PS: I have also tried to use result_array() nothing has worked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:58:42+00:00Added an answer on June 15, 2026 at 9:58 am

    You should combine all field names into one string instead of separating them as multiple parameters to select() function

    $this->db->select('e.emp_no, e.birth_date, e.first_name, e.last_name, e.gender, e.hire_date')
            ->from('employees AS e')
            ->join('titles AS t', 'e.emp_no = t.emp_no')
            ->join('salaries AS s', 't.emp_no = s.emp_no')
            ->join('dept_emp AS de', 's.emp_no = de.emp_no')
            ->join('departments AS d', 'de.dept_no = d.dept_no')
            ->join('dept_manager AS dm', 'd.dept_no = dm.dept_no')
            ->limit($limit, $offset)
            ->order_by($sort_by, $sort_order)
            ->group_by('e.emp_no')
            ->where('t.title', 'staff'); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this query SELECT * FROM tblContracts LEFT JOIN tblPartys ON tblContracts.id = tblPartys.Contract_id INNER
This is my query: SELECT DISTINCT ap.apptype_id FROM tblSubmission AS s JOIN tblApp AS
I have this query: select top(2) property_id_ref ,image_file ,property_name from property_master a inner join
This is my current query: SELECT DISTINCT t.* FROM filter AS f INNER JOIN
I wrote this query : SELECT * FROM etape_prospection INNER JOIN type_prospection ON etape_prospection.type_prosp_id
I have this query: SELECT p.id, r.status, r.title FROM page AS p INNER JOIN
I am executing this query: SELECT voterfile_county.Name, voterfile_precienct.PREC_ID, voterfile_precienct.Name, COUNT((SELECT voterfile_voter.ID FROM voterfile_voter JOIN
Consider This Query: SELECT [Order Details].OrderID, c.CategoryName, COUNT(c.CategoryID) FROM [Order Details] INNER JOIN Products
I have this query: SELECT COUNT(*) AS `numrows` FROM (`tbl_A`) JOIN `tbl_B` ON `tbl_A`.`B_id`
When I run this query: select First_Name, sum(a) a, sum(b) b, sum(c) c from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.