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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:14:52+00:00 2026-05-29T18:14:52+00:00

I have a very crazy query I know, but when I run it it

  • 0

I have a very crazy query I know, but when I run it it returns all matches regardless of whether or not field mvideo is empty or not.

the query is:

SELECT * 
FROM `weaponsprojects` 
WHERE mvideo != "" 
  AND credit7 = "' .$person. '" 
   OR credit2 = "' .$person. '" 
   OR credit3 = "' .$person. '" 
   OR credit4 = "' .$person. '" 
   OR credit5 = "' .$person. '"
   OR credit6 = "' .$person. '"
   OR credit1 = "' .$person. '"
   OR credit8 = "' .$person. '"
   OR credit9 = "' .$person. '"
   OR credit10 = "' .$person. '"
   OR credit11 = "' .$person. '"
   OR credit12 = "' .$person. '"
   ORDER BY usort'

and it returns when any of the credits equal the person but it completely ignores the mvideo part. Why is this??

Edit: the field is not NULL, just simply empty no spaces just blank

  • 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-29T18:14:53+00:00Added an answer on May 29, 2026 at 6:14 pm

    i think that the WHERE condition is logically flawed… you need some precedence here, like so:

    SELECT * 
    FROM `weaponsprojects` 
    WHERE mvideo != "" 
      AND (credit7 = "' .$person. '" 
       OR credit2 = "' .$person. '" 
       OR credit3 = "' .$person. '" 
       OR credit4 = "' .$person. '" 
       OR credit5 = "' .$person. '"
       OR credit6 = "' .$person. '"
       OR credit1 = "' .$person. '"
       OR credit8 = "' .$person. '"
       OR credit9 = "' .$person. '"
       OR credit10 = "' .$person. '"
       OR credit11 = "' .$person. '"
       OR credit12 = "' .$person. '")
       ORDER BY usort'
    

    by adding the ( and the ) we tell the WHERE statement: “either mvideo is not empty and it matches one of the OR statements”

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

Sidebar

Related Questions

This is driving me crazy. I have a very simple user control: public int?
I have read the very good blog post of Rob Conery Crazy Talk: Reducing
Okay, this is just a crazy idea I have. Stack Overflow looks very structured
I have a very strange case where my Module is working but my Module's
Very basic question, but I have an error in my code that can only
It's crazy, but query performance is about 50% WORSE after I add a primary
We have a very important application, but so far no source code. The application
This is most def something very simple, but it is driving me crazy, cant
This is a very beginner question, but driving me crazy. Why isn't this code
I know this has to be simple, but it's driving me crazy. I'm trying

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.