0

I want to create report using php. This is file : Some text, 10/07/2010 04:32 Some text, 10/07/2010 04:32 Some text, 12/07/2010 04:32 Some text, 13/07/2010 04:32

Through UI we are entering Start and end date. I have to create report based on that date. How can i do that

2 Answers 2

1
  1. Get line from file.

  2. Get date representation using substr and strlen.

  3. Convert date to UNIX time format using strtotime.

  4. Convert entered date to UNIX time format.

  5. Compare two dates using simple < and > conditions.

Sign up to request clarification or add additional context in comments.

Comments

0

You'll want to build an HTML form with some date fields, either 3 dropdowns or use something like a jQueryUI datepicker.

Don't forget to validate your input!

Then when that's posted, you can create an sql WHERE clause from it. Then you can connect to your database and pull out the data.

Then you have a choice of just looping the data and outputting the list to the screen, and having the user save it as a CSV. Or you can buffer the output using something like ob_start() outputting your data, then assigning it to a variable using ob_get_flush() and then ouputting some CSV headers using header() and passing it out as a file.

Have a google around, there are lots of tutorials for creating CSV files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.