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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:53:08+00:00 2026-06-09T07:53:08+00:00

I currently have multiple search fields within one form which the user can pick

  • 0

I currently have multiple search fields within one form which the user can pick and choose which one to filter, everything works perfectly until I add the date range to it. If I add the date range alone without any other fields to filter it works so I know it is not that I am writing the query wrong. Please help me figure this out. THANKS!

This is the query that works: (Also for some reason doing SELECT * won’t work, I have to type the name of all the fields I want to show)

It includes the part of the form that includes the date range.

<li class="form-line form-line-column" id="id_29">
    <label class="form-label-top" id="label_29" for="input_30">
        From Date:
    </label>
    <div id="cid_29" class="form-input-wide">
        <input type="text" class="form-textbox validate" id="datepicker" name="from_date" size="10" />
    </div>
</li>
<li class="form-line form-line-column" id="id_29">
    <label class="form-label-top" id="label_29" for="input_8">
        To Date:
    </label>
    <div id="cid_29" class="form-input-wide">
        <input type="text" class="form-textbox validate" id="datepicker2" name="to_date" size="10" />
    </div>
</li> 

<?php
    $sso = $_GET['sso'];
    $assigned_to = $_GET['assigned_to'];
    $case_status = $_GET['case_status'];
    $startdate = $_GET['from_date'];
    $enddate = $_GET['to_date'];
    $subject = $_GET['subject'];

    $sql = ("SELECT 
                id, sso, full_name, case_status, assigned_to, resolution, 
                description, updated, created, additional_notes, subject
            FROM rmstable2
            WHERE 
                sso LIKE '%$sso%' AND
                case_status LIKE '%$case_status%' AND
                assigned_to LIKE '%$assigned_to%' AND
                subject LIKE '%$subject%'");
?>

This is the query I want:

<?php
    $sql = ("SELECT 
                id, sso, full_name, case_status, assigned_to, resolution, 
                description, updated, created, additional_notes, subject
             FROM rmstable2
             WHERE 
                sso LIKE '%$sso%' AND
                case_status LIKE '%$case_status%' AND
                assigned_to LIKE '%$assigned_to%' AND
                subject LIKE '%$subject%'
                AND created >= '$startdate'
                AND created <= '$enddate'");
?>
  • 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-09T07:53:10+00:00Added an answer on June 9, 2026 at 7:53 am

    use BETWEEN for that and don’t forget to wrap the dates with DATE( )

    $sql = ("SELECT id, sso, full_name, case_status, assigned_to, 
                    resolution, description, updated, created, 
                    additional_notes, subject 
            FROM  rmstable2 
            WHERE sso LIKE '%$sso%' AND 
                  case_status LIKE '%$case_status%' AND 
                  assigned_to LIKE '%$assigned_to%' AND 
                  subject LIKE '%$subject%' AND 
                  DATE(created) BETWEEN DATE('$startdate') AND DATE('$enddate')");
    

    UPDATE 1

    how about changing AND to OR

    $sql = ("SELECT id, sso, full_name, case_status, assigned_to, 
                    resolution, description, updated, created, 
                    additional_notes, subject 
            FROM  rmstable2 
            WHERE sso LIKE '%$sso%' OR 
                  case_status LIKE '%$case_status%' OR
                  assigned_to LIKE '%$assigned_to%' OR 
                  subject LIKE '%$subject%' OR
                  (DATE(created) BETWEEN DATE('$startdate') AND DATE('$enddate'))");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table which has two fields. There can be multiple rows with
I currently have one project that currently contains multiple packages. These packages make up
I currently have a single web server hosting multiple WordPress sites which use W3TC.
I am currently trying to communicate a parent process which should have multiple children
Currently I have a database with the following relationships: One Client has multiple Entities
Currently we have dueling select lists where you can select multiple employees from Available
I am currently creating a multiple dropdown query where the user can query by
I currently have an iPhone application with a tabbar and multiple viewcontrollers. All the
I currently have an app that requires connection to a server in multiple activities.
If you install multiple versions of python (I currently have the default 2.5, installed

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.