hi
i have a table where dates and other info are getting inserted...
i have a form where the user can select a start date end date..
based on the start date and end date ..i want to retrieve all the content stored between these dates.....

$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.

hi
i am doing attendance sheet..
wen the admin wants to check the attendance between two date then he will give the start and end date...
in the table there is one column for date...the table contain the user id(varchar) ,date(date),time(varchar)

how does the admin enter the dates? does he have a form ? what is the name of those text fields ? basically, this will work.

$sql="select * from table where date between '$start_date' and '$end_date'";

$start_date and $end_date are post variables of the form.

ya he is having a form the field names are day1 day2........the code tat u have sent id working....how to sort using single column un table

using order by clause.

order by date asc | desc

thanks its working

you are welcome!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.