views:

107

answers:

2

Hi,

We have a web application that creates a dynamic PHP page with all the MySQL stored details a user has entered via a number a forms. So far so good, but we want this information stored some how to be refereed to at a later date, as an administrator can make changes to the data, which reflects on calculations that are worked out from this saved data.

When going back over this saved data we need to be able to see all the information submitted for that particular calculation, so if that data has changed we will see what is was relating to that calculation. Now we have thought about maybe a snapshot when the calculation is done, pdf of the webpage or something similar would do, but is this simple to do?

I hope this makes sense...

A: 

Hmm this is quite difficult to understand. Sounds like you should make a new MySQL table containing snapshots of the calculations and the time they were saved?

What kind of data are you looking to snapshot?

Gausie
This was now first thought, but the original database is very large, and spread over a few tables, so would be a pain to do t this way.
jimbo
An actual image, (jpeg or the like) would do of the dynamic page, and attached this to the calculation, that way if the administrator needed to revert back they could.
jimbo
Right, I've grabbed the class from this site (http://www.phpclasses.org/browse/package/4608.html). You can find it here: http://pastebin.ca/1689336.You can use that PHP class to save a screenshot of the page as a JPG
Gausie
I think this would have been a good call, but we are running on a linux server...
jimbo
Do you have access to the server? Can you use php's exec() with no problem? If so, give this a go http://www.mysql-apache-php.com/website_screenshot.htm
Gausie
If you can't do this, you need to look at an alternative method of the snapshot effect. I imagine if data can be recorded into an image, all the data displayed could go into a custom "snapshot" table. None of the source data, just the numbers you would see when looking at the printscreen. This will save you space, as you will not be committing unnecessary information to memory, just the numbers. With an example, I could give more precise advice.
Gausie
A: 

You can easily generate PDF files from a web page in PHP. Many libraries are able to do this. Like FPDF or FPDI (opensource projects).

mere-teresa
I don't think these can create a pdf from a webpage can they?
jimbo
You are looking for HTML2FPDF in this case.
mere-teresa