开发者

php:create report

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


  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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜