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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:15:02+00:00 2026-05-14T14:15:02+00:00

with my table. person_id serial NOT NULL, firstname character varying(30) NOT NULL, lastname character

  • 0

with my table.

person_id serial NOT NULL,
  firstname character varying(30) NOT NULL,
  lastname character varying(30),
  email character varying(50),
  username character varying(20) NOT NULL,
  "password" character varying(100) NOT NULL,
  gender character varying(10),
  dob date,
  accesslevel smallint NOT NULL,
  company_id integer NOT NULL,//Reference to table company
  position_id integer NOT NULL,//Reference to table position
company_id serial NOT NULL,
  company_name character varying(80) NOT NULL,
  description character varying(255),
  address character varying(100) NOT NULL,

In my controller

........................
// load data
$persons = $this->person_model->get_paged_list(10,0);
// generate table data
$this->load->library('table');
$this->table->set_empty(" ");
$this->table->set_heading('No', 'FirstName', 'LastName','E-mail','Company''Gender', 'Date of Birth', 'Actions');
foreach ($persons as $person){
    $this->table->add_row(++$i, $person->firstname,
                                     $person->lastname,
                                     $person->email,
                                     $person->company_name,
                                    //HOW CAN I GOT THE POSITION TITLE ?,
                            strtoupper($person->gender)=='M'? 'Male':'Female',
                            date('d-m-Y',strtotime($person->dob)),
}

My model

<?php
class Person_Model extends Model {

    private $person= 'person';

    function Person(){
        parent::Model();
    }

    function list_all(){
        $this->db->order_by('person_id','asc');
        return $this->db->get($person);
    }

    function count_all(){
        return $this->db->count_all($this->person);
    }

    function get_paged_list($limit = 0, $offset = 0) {
         $this->db->limit($limit, $offset);
         $this->db->select("person.*, company.company_name as company");
         $this->db->from('person');
         $this->db->join('company','person.company_id = company.company_id','left');
         //MY QUESTION:? CAN I JOIN MORE WITH TABLE POSITION?

        $query = $this->db->get();    
        return $query->result();
     }

    function get_by_id($id){
        $this->db->where('person_id', $id);
        return $this->db->get($this->person);
    }

    function save($person){
        $this->db->insert($this->person, $person);
        return $this->db->insert_id();
    }

    function update($id, $person){
        $this->db->where('person_id', $id);
        $this->db->update($this->person, $person);
    }

    function delete($id){
        $this->db->where('person_id', $id);
        $this->db->delete($this->person);
    }
}
?> 
  • 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-14T14:15:03+00:00Added an answer on May 14, 2026 at 2:15 pm

    Yes, you can. Just use as many $this->db->join(…) as you need.

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

Sidebar

Related Questions

Steps to reproduce error: CREATE TABLE person ( person_id int(11) NOT NULL AUTO_INCREMENT, firstname
I have this person table as super parent, id firstname lastname email telephone ...
I have three tables like this: Person table: person_id | name | dob --------------------------------
I have a table in a MySQL table called persons id LastName FirstName 1
So I have three tables: Table Place: _id autoincrement not null primary key, name
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 |
I have a table with two columns: person_id person_id with whom 1st field id
I have three tables Person (id, name, email) Address (id, Person_id, address, verified) Person_Claimed
This example is taken from w3schools . CREATE TABLE Persons ( P_Id int NOT
Suppose I have the following table: PERSON : ID INT NAME STRING LASTNAME STRING

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.