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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:53:10+00:00 2026-05-25T05:53:10+00:00

What are the pros and cons of fetching the database and returning the query

  • 0

What are the pros and cons of fetching the database and returning the query object or the result/result_array?

$query = $this->db->get('mytable');
return $query;

vs

$query = $this->db->get('mytable');
return $query->result; //or result_array()

I know that if you return the query object, it makes it flexible for the developer to fetch whatever type of resource she wants. But this could lead to more ambiguity in code design.

What is considered best practice?

  • 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-25T05:53:10+00:00Added an answer on May 25, 2026 at 5:53 am

    I guess it depends on what you need to do with it, process it further or show it to the user. If simple the results have to be shown in the View, I’d rather return the result otherwise if more “complex” processing is needed you could return the query-object.

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

Sidebar

Related Questions

TLDR: What are the pros/cons of using an in-memory database vs locks and concurrent
This is more a question of pros/cons between PHP and JAVA. Iv been doing
What are the pros/cons of de-normalizing an enterprise application database because it will make
I'm curious as to what the major pros/cons are of using an object relational
I'd like this thread to be some kind of summary of pros/cons for overriding
Duplicates Why should I use document based database instead of relational database? Pros/Cons of
This is a somewhat subjective question, but I'd like to hear the pros/cons for
Though I've used both, I never really got the decisions or pros/cons that go
This may be a silly question for some of you, but what are Pros/Cons
In Java what pros/cons exist surrounding the choice to use a.getClass() or A.class ?

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.