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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:14:49+00:00 2026-05-22T22:14:49+00:00

I need to do a few things here and I’m confused on how this

  • 0

I need to do a few things here and I’m confused on how this should work.

Here are the variables I need to work with:

Date Range
Employee ID
Team

and a possible additional search term (acct_number=’$_REQUEST[q]’) if someone wants to search for a specific account number.

Each variable is populated with a drop down select, the first option being * for all records. The dates are set using a date picker, calendar style, and it’s automatically set as date 1=seven days ago and date 2=today.

My query:

SELECT * FROM table
WHERE job_date BETWEEN '$search_date1' AND '$search_date2' AND
    employee_id='$searched_employee' AND team='$searched_team' AND
    acct_number='$_REQUEST[q]'
ORDER BY employee_id desc

I know the records are there but my search still returns no records. After the date, the AND employee_id=’$searched_employee’ could be * so it should return all records and the same goes for the team.

Echoing the variables to try make sure something was set gives me this:
No records found for “Employee” for dates between 2011-05-01 and 2011-05-31 and on team “Team”.

Can I not request more with AND in the Select statement after I use the BETWEEN?

Thanks in advance!

–Joel

  • 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-22T22:14:49+00:00Added an answer on May 22, 2026 at 10:14 pm

    You cannot use ‘*’ wildcard for WHERE clause.

    Try using variables for conditions you put in your query, like:

    if( is_numeric( $searched_employee ) )
      $employee_cond = " AND employee_id=$searched_employee";
    else
      $employee_cond = "";
    

    and put $employee_cond inside your query instead of AND employee_id='$searched_employee'.
    Repeat for every condition you need.

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

Sidebar

Related Questions

I can do a few things with PowerPoint, but I need to learn more
I need to impl a few basic features in this server: display a nice
I have an issue where I need to ONLY get a few things from
I have a few things that need to be done asynchronously during my application's
I need to do few things before any method on org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean getting called. Hence
I don't know if this is possible but I want to do a few
i need to write few applications about lowlevel videocard controling for my coursework. For
I need to initialize few objects, it can take a while so I want
I have a Java servlet from which I need to send few notifications to
I need to delete a few fields from the table in the database. I

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.