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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:30:54+00:00 2026-06-12T20:30:54+00:00

I have a var_dumped query here which displays a wrong result. select p.* ,

  • 0

I have a var_dumped query here which displays a wrong result.

select p.*
, case when p.specials_new_products_price >= 0.0000 
  and (p.expires_date > Now() or p.expires_date IS NULL) 
  and p.status != 0 then 
      p.specials_new_products_price 
  else 
      p.products_price 
end price 

from wp_global_products_table p 
INNER JOIN wp_blogs s ON s.blog_id = p.blog_id 
where p.products_name like '%indifi%' 
or p.products_description like '%indifi%' 
and s.countries_id = '168' 
and global_category_id = '15' 
and p.display_product = '1' 
and p.products_status = '1' 
order by p.products_date_added DESC, p.products_name"

Here is the original query.

$catglobal_sql = "select p.*, case when p.specials_new_products_price >= 0.0000 and (p.expires_date > Now() or p.expires_date IS NULL or p.expires_date ='0000-00-00 00:00:00') and p.status != 0 then p.specials_new_products_price else p.products_price end price from ".TABLE_GLOBAL_PRODUCTS." p INNER JOIN ".TABLE_STORES." s ON s.blog_id = p.blog_id where MATCH (p.products_name,p.products_description) AGAINST ('%".$search_key."%') ".$country_q." ".$zone." ".$currency_type." ".$search_cat." and p.display_product = '1' and p.products_status = '1' ".$duration." ".$product_type." ".$price_range." order by p.products_date_added DESC, p.products_name";
if (!mysql_num_rows(mysql_query($catglobal_sql))) {
$catglobal_sql = "select p.*, case when p.specials_new_products_price >= 0.0000 and (p.expires_date > Now() or p.expires_date IS NULL) and p.status != 0 then p.specials_new_products_price else p.products_price end price from ".TABLE_GLOBAL_PRODUCTS." p INNER JOIN ".TABLE_STORES." s ON s.blog_id = p.blog_id where p.products_name like '%".$search_key."%' or p.products_description like '%".$search_key."%' ".$country_q." ".$zone." ".$currency_type." ".$search_cat." and p.display_product = '1' and p.products_status = '1' ".$duration." ".$product_type." ".$price_range." order by p.products_date_added DESC, p.products_name";
}

Say that, im searching “Indifi” which is available on the database, the Indifi’s global_category_id has a value of 3.

As you can see on the var_dumped result, the global_category_id is 15 so “Indifi” should not be displayed however, it does.

What should be the problem on my query?

  • 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-12T20:30:56+00:00Added an answer on June 12, 2026 at 8:30 pm

    Try using brackets here:

    ...where (p.products_name like '%indifi%' 
    or p.products_description like '%indifi%')
    and s.countries_id = '168'
    ... 
    

    So that you’re not OR-ing too much together.

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

Sidebar

Related Questions

I have the following query: SELECT AVG (q1) AS q1, AVG (q2) AS q2,
I have the following Query: SELECT a.name_f, a.uid, a.name_l, a.profile_pic, b.position FROM users a
I have an associative array which when var dumped looks like this: Array (
Here's the code I have: var commandsBuffer = List[String]() commandsBuffer ::= cmd.exe commandsBuffer ::=
I've got a weird problem here. I've been trying to find out whats wrong
I have got a return from a server which is a block of html,
I have the below LINQ method which gets called from a User Control and
I have a UIPickerController to select videos in my App and it is crashing
We have implemented our domain model using the accountability pattern, which we are trying
I have an array $suggested_cities , here it is vardumped: array(3) { [15526]=> string(9)

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.