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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:07:00+00:00 2026-05-28T08:07:00+00:00

I am new to Codeigniter and PHP.. while doing some operations i have some

  • 0

I am new to Codeigniter and PHP..

while doing some operations i have some doubts ,especially in the database libraries .

$get = "select filed_1 from tbl_ctc where ctc=?";
$get = $this->db->query($get,array($ctc_n));

if ($get)
{

 //do some operations 
}
else
{
 //do some another operations 

}

What will be the return value of $get if it is success ?

Expecting opinion & suggestion [downvotes too]

Thank you.

  • 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-28T08:07:00+00:00Added an answer on May 28, 2026 at 8:07 am

    What “opinions and suggestions” do you expect?

    The query() method returns a result object when you use read queries (like a select), while with write queries (like an insert or update) it returns TRUE or FALSE.

    In case of a SELECT, i.e., you might want to check if it has any result:

    $query = $this->db->query($select_query);
    if($query->num_rows() > 0)
    {}
    

    While, in case of an INSERT for ex.:

    $query = $this->db->query($insert_query);
    if($query)   // or if(FALSE !== $query)
    {}
    else
    {}
    

    Note that if you are using Active Record, you’ll have the result() / row() and result_array() / row_array() methods that will return either a full object/array or an empty one, so you’ll need to check for those values instead.

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

Sidebar

Related Questions

I'm new to PHP/MySQL and super-new to CodeIgniter.. I have information in many MySQL
I am using Codeigniter to build my project. Here i have some doubts or
I am new to PHP codeigniter, how to get checkbox values using php Codeigniter
I'm new to CodeIgniter, and I need some help. I'd like to implement the
I'm new to codeigniter this is my case: I have a homepage with a
Good morning! I'm having great success so far with CodeIgniter. I'm new to PHP
Possible Duplicate: Error : get property of non-object I am new to codeigniter model,
Im new to codeigniter and php, mysql and i am making a codeigniter app,
I am new to CodeIgniter, but not new to PHP, and I was wondering
i have download the new codeigniter 2.0 and put my controller,model and view files

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.