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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:24:13+00:00 2026-05-18T12:24:13+00:00

I have a number of tables that I’m trying to access in CodeIgniter, and

  • 0

I have a number of tables that I’m trying to access in CodeIgniter, and one of them is basically a collection of foreign keys from the other tables, most of which are only two fields: a unique id and a name. The “campaigns” table, let’s call it, pulls data from other tables in the form of those tables’ ids (because the names may not be unique).

Now what I want to do is display the “campaigns” data in human-readable form, meaning, showing the foreign names, not the ids. I think this is called a ‘join,’ but I’m not 100% certain on that. I checked MySql’s page and they say that that isn’t actually what foreign keys are for, but I thought that you needed foreign keys for a join, so I’m really just more confused now.

Do I really use joins and foreign keys for this? Thanks in advance.

  • 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-18T12:24:13+00:00Added an answer on May 18, 2026 at 12:24 pm

    The foreign key provides a link to another record in the same or another table (usually the latter). A join uses common data in two tables (sometimes the same table) to provide a link between them.

    If you have two tables that you want to join and the only common factor between those two tables is in a third table (the one with all the foreign keys) you will need to perform 2 joins.

    Example

    SELECT *.table1, *.table2 FROM table1
    LEFT JOIN foreign_key_table ON foreign_key_table.id1 = table1.id
    LEFT JOIN table2 ON foreign_key_table.id2 = table2.id
    WHERE.....
    

    In Codeignter:

    $this->db->select('*.table1, *.table2');
    $this->db->from('table1');
    $this->db->join('foreign_key_table', 'foreign_key_table.id1 = table1.id');
    $this->db->join('table2', 'foreign_key_table.id2 = table2.id');
    $this->db->where('...');
    

    You can find all the information you need here – http://codeigniter.com/user_guide/database/active_record.html

    Hope this helps.

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

Sidebar

Related Questions

I have a number of child tables that have a foreign key to a
I have a number of static classes that contain tables like this: using System;
Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME
I have a TABLE elements with one COLUMN number, type SMALLINT that contains numbers
I have a number of tables that will be looked up using the url
I have a number of tables with text around them describing them. Something like
What are the maximum number of tables that you can have in: SQL CE4
I have a number of tables in my DB that hold references to an
I have a number of tables that use the Postgres Partitioning feature. I want
I have a number of tables with lots of columns that I'm using Dynamic

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.