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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:20:33+00:00 2026-06-14T15:20:33+00:00

in get_poll function in following Poll model: class Poll_model extends CI_Model { public function

  • 0

in get_poll function in following Poll model:

class Poll_model extends CI_Model 
{
    public function get_poll($parameter) {
        $this->db->select('question.id, question.title, question.question, answer.answer')->from('answer')->join('question', 'answer.question_id = question_id')->where('question.id',$parameter);
        $query = $this->db->get();
        return $query->result_array();
}

Because I’m using join to get result from 2 table and table question and answer both have column content, so in the result_array, the structure like this:

Array ( [id] => 1 [title] => favourate character [content] => Green ) 1

The there’s only answer content, I think the question content was overwrite, because both of them have the same column ‘content’. the table structure shown below:

CREATE TABLE `answer` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `question_id` int(11) unsigned NOT NULL,
  `content` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `question_id` (`question_id`),
  CONSTRAINT `answer_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;


CREATE TABLE `question` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(128) NOT NULL DEFAULT '',
  `content` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;

Is there any way to solve this problem?

  • 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-14T15:20:34+00:00Added an answer on June 14, 2026 at 3:20 pm

    Simply rename the columns inside the ->select() call like this:

    $this->db
        ->select('
            question.id id, 
            question.title title, 
            question.content question, 
            answer.content answer')
        ->from('answer')
        ->join('question', 'answer.question_id = question_id')
        ->where('question.id', $parameter);
    

    The result rows now should contain a question and a answer index.

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

Sidebar

Related Questions

I have the following code: XService.start = function() { setInterval(XService.poll(), XService.pollInterval); } This works
file1: <?php require_once('simpletest/autorun.php'); require_once('simpletest/web_tester.php'); class TestOfRankings extends WebTestCase { function tesetWeAreTopOfGoogle() { $this->get('http://poll:8888/index.php/admin/unit_test'); $this->assertText('this
GET_DATA() GET_DATA() contains this: var xhr; ... function get_data( phrase ) { xhr =
why i see this error message ( ! ) Notice: Undefined index: poll in
In the pseudocode below I have a poll() function that gets called forever in
I'm trying to fix a custom poll function ( see http://pastie.org/1298915 ). It is
i i am checking network type by calling this function ConnectivityManager cm = (ConnectivityManager)
I want to show a poll result for a specific poll question. When question
I have this following piece of code: var stats = { ...., checkExistance :
I am using primeface 3.2. i am using ajax poll to get every reaction

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.