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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:51:21+00:00 2026-05-14T04:51:21+00:00

in code igniter you can type: $query = $this->db->query(YOUR QUERY); foreach ($query->result() as $row)

  • 0

in code igniter you can type:

$query = $this->db->query("YOUR QUERY");

foreach ($query->result() as $row)
{
   echo $row->title;
   echo $row->name;
   echo $row->body;
}

i guess that the query method returns the object it’s part of. am i correct?

if i am, how do you type the line where it returns the object?

so what i wonder is how it looks like inside the query method for the above code to be functional.

public function query($sql) {
    // some db logic here with the $sql and saves the values to the properties (title, name and body)

    return X
}

with other words, what should X be?

  • 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-14T04:51:21+00:00Added an answer on May 14, 2026 at 4:51 am

    That function is located in /system/database/DB_driver.php:244

    On a successful query, it returns a new db result object for the database driver (probably) set in your application’s database config.

    ex: CI_DB_mysql_result (located in /system/database/drivers/mysql/mysql_result.php );

    with other words, what should X be?

    $driver         = $this->load_rdriver();
    $RES            = new $driver();
    $RES->conn_id   = $this->conn_id;
    $RES->result_id = $this->result_id;
    

    from DB_driver.php:366

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

Sidebar

Related Questions

In code igniter, you can connect database and make queries in controller like: $this->db->query(Your
You can use the URL helper in Code Igniter to load CSS and Javascript
How can I hide the parameters in Codeigniter? I have this URL: http://example.com/profile/1 I
I've been rebuilding my site with code igniter and am having trouble validating the
I have written an application in Code Igniter. Unless i declare the <!DOCTYPE HTML>
I write this from in Codeigniter as a form_view.php . <?php echo form_open('form'); ?>
Looking some frameworks like Code Igniter I see they use a defined check on
I want to convert my array value into $row in CodeIgniter, result of Array()
I am using code igniter and I am trying to send multiple arrays to
I'm using this code in Codeigniter to generate XML: public function get_cuisine() { $this->load->dbutil();

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.