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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:47:16+00:00 2026-05-30T23:47:16+00:00

I am definitely not seeing the issue as to why this isn’t working. Any

  • 0

I am definitely not seeing the issue as to why this isn’t working. Any ideas on possibilities?

$this->db->select(CONCAT_WS(' ', 'users.first_name', 'users.last_name') 'AS name');

EDIT:

I updated with the suggested line but for some reason I’m still getting an error.

function getAllMessages($user_id)
{
    $this->db->select('pm.id');
    $this->db->select('pm.subject');
    $this->db->select("CONCAT_WS(' ', users.first_name, users.last_name) AS name");
    $this->db->select("DATE_FORMAT('pm.date_sent', '%M %D, %Y'");
    $this->db->select('pm.message_read');
    $this->db->from('users_personal_messages AS pm');
    $this->db->join('users', 'users.user_id = pm.sender_id');
    $this->db->where('recipient_id', $user_id);
    $query = $this->db->get();
    if ($query->num_rows() > 0)
    {
        return $query->result();;
    }
    else
    {
        return 0;
    }
}

UPDATE:

function getAllMessages($user_id)
{
    $this->db->select('pm.id');
    $this->db->select('pm.subject');
    $this->db->select("CONCAT_WS(' ', users.first_name, users.last_name) AS name");
    $this->db->select("DATE_FORMAT('pm.date_sent', '%M %D, %Y')");
    $this->db->select('pm.message_read');
    $this->db->from('users_personal_messages AS pm');
    $this->db->join('users', 'users.user_id = pm.sender_id');
    $this->db->where('recipient_id', $user_id);
    $query = $this->db->get();
    if ($query->num_rows() > 0)
    {
        return $query->result();;
    }
    else
    {
        return 0;
    }
}

SECOND UPDATE:

function getAllMessages($user_id)
{
    $this->db->select('pm.id');
    $this->db->select('pm.subject');
    $this->db->select("CONCAT_WS(' ', users.first_name, users.last_name) AS name");
    $this->db->select(DATE_FORMAT(pm.date_sent, '%M %D, %Y'));
    $this->db->select('pm.message_read');
    $this->db->from('users_personal_messages AS pm');
    $this->db->join('users', 'users.user_id = pm.sender_id');
    $this->db->where('recipient_id', $user_id);
    $query = $this->db->get();
    if ($query->num_rows() > 0)
    {
        return $query->result();;
    }
    else
    {
        return 0;
    }
}
  • 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-05-30T23:47:18+00:00Added an answer on May 30, 2026 at 11:47 pm

    You need to quote the string properly. Column names should not be quoted, however the whole string parameter to select() must be quoted.

    $this->db->select("CONCAT_WS(' ', users.first_name, users.last_name) AS name");
    

    See the CodeIgniter select() docs for lots of examples…

    Update

    Your error is a missing parenthesis on the DATE_FORMAT() line:

    $this->db->select("DATE_FORMAT(pm.date_sent, '%M %D, %Y')");
    //------------------------------------------------------^^^^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems really easy, but it's definitely not working as expected. In WPF 4.0,
So this thread is definitely NOT a thread for why Python is better than
I’m currently facing an issue that my Oracle knowledge cannot solve, I’m definitely not
Is there any major advantage of managed C++/CLI over C#. Definitely not the syntax
I am trying to understand this behavior. It's definitely not what I expect. I
From regular-expressions.info : \b\w+(?<!s)\b . This is definitely not the same as \b\w+[^s]\b .
Perhaps not directly programming related, but definitely product / commercially related. And I can't
I am not expecting a definite yes or no. Any knowledge you might have
I'm definitely a newbie to ruby (and using 1.9.1), so any help is appreciated.
I realize there's no definitely right answer to this question, but when people talk

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.