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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:58:32+00:00 2026-06-08T10:58:32+00:00

I am having problem getting my query to exclude my soft delete column I

  • 0

I am having problem getting my query to exclude my “soft delete” column I have attached my code below any tips on getting this to work? it shows rows that have the deleted = 1 and i need it just to show 0

$query=mysql_real_escape_string($_GET['query']);

$query_for_result=mysql_query("SELECT * FROM Assets WHERE 
`Badge` like '%".$query."%' or 
`Status` like '%".$query."%' or 
`First Name` like '%".$query."%' or 
`Last Name` like '%".$query."%' or 
`Service Tag` like '%".$query."%' or 
`Asset Tag` like '%".$query."%' and
`deleted` = '0' ")or die(mysql_error());



if(mysql_num_rows($query_for_result1)==0){

}

while($data_fetch=mysql_fetch_array($query_for_result))
{

echo '<h3>';    
echo "<a href=\"modify.php?id=" . $data_fetch['id'] . "\">" . $data_fetch['First Name']  . ' ' . $data_fetch['Last Name'] . "</a>";
echo '<br/><b>Badge:</b> '. $data_fetch['Badge'];
echo '<br/> <b>Service Tag:</b> '. $data_fetch['Service Tag'];
echo ' <b>Asset Tag:</b> '. $data_fetch['Asset Tag'];
echo '<br/> <b>Status:</b> '. $data_fetch['Status'];
echo '<br/><b>Employee Status: </b>';
    if( $data_fetch['Employee Status'] == 'Active' ){
echo '<font color="#32CD32">' . $data_fetch['Employee Status'] . '</font>';
    }
elseif( $data_fetch['Employee Status'] == 'Terminated' ){
echo '<font color="red">' . $data_fetch['Employee Status'] . '</font>';}
echo '<br/> <b>Last Modified:</b> '. $data_fetch['Last Modified'];
echo "<span> </span>";
echo '</h3>';
echo '<br/><p>' ; 

}
  • 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-08T10:58:34+00:00Added an answer on June 8, 2026 at 10:58 am

    All of the conditionals are in the same scope. What this means is, as soon as you hit the first condition that is true, the entire where clause is true. You need to put the OR clauses in parenthesis.

    WHERE 
    (
    `Badge` like '%".$query."%' or 
    `Status` like '%".$query."%' or 
    `First Name` like '%".$query."%' or 
    `Last Name` like '%".$query."%' or 
    `Service Tag` like '%".$query."%' or 
    `Asset Tag` like '%".$query."%'
    )
    and `deleted` = '0'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having problem getting this piece of code to run. The class is
I am having trouble with the query in this code. The problem is one
I'm having a problem getting a change event to register with the following code:
I'm having a problem getting this test case to work. Can anyone point me
Having a bit of a problem getting my LINQ query to return the object
I'm having trouble getting the position of an address. However, this problem occurs only
I am having a problem getting multiple attributes for one item. Below is my
I seem to be having a problem with this jquery code. I want to
I'm having a really hard time writing this query and getting it to work
Hi I'm having a problem with getting a conditional query to work. I want

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.