•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,991 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,771 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1263 | Replies: 7 | Solved
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
$sql="select * from table where (start_date between '$start_date' and '$end_date') or (end_date between '$start_date' and '$end_date')";
considering start_date and end_date are the columns of your table, the first condition will fetch the records if the start_date lies between the range of $start_date and $end_date (the user's input). similarly, it checks if end_date lies between the range.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
how does the admin enter the dates? does he have a form ? what is the name of those text fields ? basically, this will work.
$start_date and $end_date are post variables of the form.
$sql="select * from table where date between '$start_date' and '$end_date'";
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- HOWTO: Run a Query on a Database using ODBC and return all Results into a DGV Object (C#)
- Selecting MYSQL into fields (HTML and CSS)
- pagination of mysql query results (PHP)
- DataBase Monitoring Script (Shell Scripting)
- Terrible Error while using MySQL resources (PHP)
- Php code confusion. Not sure how to describe (PHP)
- Please help me out with MySQL query (MySQL)
- Query Problem (MySQL)
- DB-Authentication php/mysql on Mac OSX v3 (PHP)
Other Threads in the PHP Forum
- Previous Thread: Looking for php/mysql tutor 10USD/hour
- Next Thread: Web Address For Free Downloading Of Pdf Copy Of A Php Book



Linear Mode