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

  • Home
  • SEARCH
  • 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 9266725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:23:06+00:00 2026-06-18T14:23:06+00:00

I’ve got this project that I’m working on in, where a user can register

  • 0

I’ve got this project that I’m working on in, where a user can register and be assigned an ID. That user then has the ability to post blogs or comment, these blogs or comments get assigned an authorID same as the users userID.

I need a way to get their name posted below these blogs or messages instead of their ID-which it currently does.

My blog controller handles the blog posting (commenting is similar) with the exception of a add blog function:

    function blogToevoegen() {
    $this->form_validation->set_rules('blogtitel', 'blogtitel',       'min_length[3]|required|xss_clean|callback_username_check');
    $this->form_validation->set_rules('blogtekst', 'blogtekst', 'min_length[2]|required|xss_clean');
    if ($this->form_validation->run() == FALSE) {
        $this->load->view('view_page', $this->view_data);
    } else {
        $data = array(
            'id' => $this->input->post('id'),
            'blogtitel' => $this->input->post('blogtitel'),
            'blogtekst' => $this->input->post('blogtekst'),
            'auteur_id' => $this->session->userdata('gebruiker_id'),
        );
        $this->db->set('datum', 'NOW()', FALSE);
        $this->db->insert('blogs', $data);
        redirect('blog/eigenblogs');
    }
}

A function that handles the displaying of the blog post (it also gets the comments linked to a blog)

 function comments() {
    $this->db->where('id', $this->uri->segment(3));
    $this->db->select('blogtitel, blogtekst, auteur_id, datum');
    $data['query2'] = $this->db->get('blogs');
    $this->db->where('boodschap_id', $this->uri->segment(3));
    $data['query'] = $this->db->get('comments');
    $data ["titel"] = "PXL - Comment";
    $data ["pagina"] = "content_comment";
    $this->load->view("view_page", $data);
}

The view code that displays these blogs (left the code for the comments out)

  <?php foreach ($query2->result() as $rij): ?>
                            <div class="post">
                                <h2><?= $rij->blogtitel ?></h2>
                                <p><?= $rij->blogtekst ?></p>
                                <p class="meta">Posted by <a href="#"><?= $rij->auteur_id ?></a> on <?= $rij->datum ?>
                                </p>
                            </div>                           
                        <?php endforeach; ?>
                        <hr> 

I need a way to change the auteur_id to a name (made out of a combination the first + last name).

  • 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-18T14:23:07+00:00Added an answer on June 18, 2026 at 2:23 pm

    What you need here is called SQL Join. Find more about it in the CI manual:

    Here is an example of what you need:

    $this->db->select('*');
    $this->db->from('blogs');
    $this->db->join('users', 'users.id = blogs.author_id');
    
    $query = $this->db->get();
    

    This will get you all the blog posts and would query for the user in the users table based on the author_id.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but

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.