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 8413793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:59:35+00:00 2026-06-10T00:59:35+00:00

I am working on codeigniter and I am writing the following query: $this->db->select(‘*’); $this->db->from(‘tbl_profile’);

  • 0

I am working on codeigniter and I am writing the following query:

$this->db->select('*');
$this->db->from('tbl_profile');
$this->db->join('tbl_msg', 'tbl_msg.msg_sender_id = tbl_profile.profile_id');
$this->db->order_by("msg_id", "desc");
$query = $this->db->get('', $config['per_page'], $this->uri->segment(3));
$data['records'] = $query->result_array();

Correspondingly I am getting the following result:

SELECT (*) FROM tbl_profile
JOIN tbl_msg ON tbl_msg.msg_sender_id = tbl_profile.profile_id

Which is returninng a wrong result as I want the result corresponding to the following query:

select * from tbl_profile as A
join (select * from tbl_msg) as B on A.profile_id = B.msg_sender_id

Please help

  • 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-10T00:59:37+00:00Added an answer on June 10, 2026 at 12:59 am

    First of all, you missing the order by clause, but I assum, you mean other differences.

    If you want that, you can use this query, what will gave you back the exact code:

    $this->db->select('*', FALSE);
    $this->db->from('tbl_profile as A');
    $this->db->join('( select * from tbl_msg ) as B', 'A.msg_sender_id = B.profile_id');
    $this->db->order_by("msg_id", "desc");
    $query = $this->db->get('', $config['per_page'], $this->uri->segment(3));
    $data['records'] = $query->result_array();
    

    From codeigniter user manual:

    $this->db->select()
    

    accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a CodeIgniter based application. My htacess looks like this: RewriteEngine On
Update: Got this working by disabling CodeIgniter Profiler which was interfering with the Ajax
I'm working on this project in Codeigniter and i created login and register script
I am using codeigniter and have working query which take user 3 images. I
This sql works in phpmyadmin but not working in codeigniter php function getProgramsHomepage(){ $data
I'm working on a CodeIgniter project.. I want to pass a uri segment from
I am working on a API for my web application written in CodeIgniter. This
I started working on CodeIgniter recently and I'm having some issues with the .htaccess
I am trying to get a multiple upload library working for my Codeigniter based
I'm working on upgrading a Codeigniter app I have running on 1.7.2 to 2.0.3

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.