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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:31:26+00:00 2026-05-29T21:31:26+00:00

I have a table that have tasks that have a duedate (to be completed

  • 0

I have a table that have tasks that have a “duedate” (to be completed by) column and a comp_status column. it also has a user id column

0 = uncomplete
1= complete

I want to do a query that shows tasks that dont have duedate of today but a duedate in the future and that have a comp_status = 0, I also want to show tasks that have a duedate of ‘0000-00-00’

$query = mysql_query("select * from taskdetail where userid='" . $rec['id'] . "' and comp_status='0'  and  duedate > '" . date("Y-m-d") . "' or duedate = '0000-00-00'  order by duedate,importantlevel ASC");

For some reason some tasks that have a completed status are still showing?
Can you help?

  • 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-29T21:31:29+00:00Added an answer on May 29, 2026 at 9:31 pm

    The problem is the you have an OR in your statement: or duedate = ‘0000-00-00’ … because of this, any record that has this quality will show up. You need to group it with your other condition regarding the duedate, like so:

    $query = mysql_query("select * from taskdetail where userid='" . $rec['id'] . "' and comp_status='0'  and  (duedate > '" . date("Y-m-d") . "' or duedate = '0000-00-00')  order by duedate,importantlevel ASC");
    

    Note the parenthesis ()

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

Sidebar

Related Questions

I have a table that contains tasks and I want to give these an
I have table (named tasks ) with column created_at that, basically, contains UNIX time-stamp.
I have a table that records when tasks were completed. Tasks belong to a
I have table that I insert data with following query (from c# code): INSERT
I have a table that has redundant data and I'm trying to identify all
I have a table that has an insert trigger on it. If I insert
I have a table that tracks the completion of interval tasks. for example, item
I have a table called Tasks. This table has the following fields ID TypeID
I have a table view that displays managed objects (Tasks). I'd like to fetch
I have a table that has php code in it to output a set

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.