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

  • Home
  • SEARCH
  • 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 8727603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:27:53+00:00 2026-06-13T08:27:53+00:00

Recently I started building a filter that sorts my data in sphinx, but the

  • 0

Recently I started building a filter that sorts my data in sphinx, but the thing is – I ran into an interesting CI bug (?). It doesn’t matter in what order I pass my WHERE attributes because CI will simply sort the results on its own.

Why do both of these queries return the same old result and is there a way how this could be fixed?

$a = $this->db->from('table')
              ->where('id', 1)
              ->or_where('id', 2)
              ->get()->result();

$b = $this->db->from('table')
              ->where('id', 2)
              ->or_where('id', 1)
              ->get()->result();

if ($a == $b) echo 'Equal';
  • 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-13T08:27:55+00:00Added an answer on June 13, 2026 at 8:27 am

    The sql queries that are generated produce the identical result sets, that’s why the object sets are identical. This has nothing to do with CI. Most sql dbs will optimize the where parameters to execute most efficiently, not by the order you specify them in (barring parenthasis or order of operation rules).

    If you want to change the ordering of your result set from your sql db, you need to use an order by.

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

Sidebar

Related Questions

I recently started building a bookmarklet that displays the EXIF data of any image
I recently started looking into building web applications using .NET MVC and I stumbled
I'm very used to working in WPF, but I have recently started building websites
I have been doing some testing on a project that I recently started building
I have recently started programming in PHP. I am building a cart in PHP.
I recently started working with a client that had an index.html file with this
I recently started using jQuery/AJAX for submitting data to my PHP API. Currently what
I recently started building a domain at home using nhibernate 3 and fluent nhibernate
Recently I started doing a C++ project, and started it using the internal building
I have started using django very recently . I am building a service with

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.