• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

[PHP] save generated PHP page as a static HTML file?

Question

saiz66    3

Hi guys,

I have a dynamic php page that pulls data from a mysql database. I want to save the generated php page to a static html page so the content doesn't update when the database gets updated. I am having a lot of problems with this. Anybody have any clue on how to do this? Thanks!!!!!!!

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Shadrack    601

Hi!

If you just want to save a .html file, most web browsers have a "Save As..." feature within the "File" menu that will allow you to save what you are looking at in a .html format.

Is this something you want to automate? As in, perhaps, creating a cache file for database results to reduce the number of database hits? I usually collect my output into a really large string variable. You then have the option to output that to the client, or use some of the PHP functions to save that output to disk (or both). You could, for instance, use the variables that land in the WHERE part of your SQL statement and produce a file name that is checked for. If the file name is found, just output that to the client. If it isn't found, generate the file (hit the database) and then output to the client.

Share this post


Link to post
Share on other sites
  • 0
Kami-    178

Ye, you can write the file into another .html or .php (without the refresh code) file :)

Share this post


Link to post
Share on other sites
  • 0
saiz66    3

thanks a lot guys, i got it to write to a html file!!!!!!!! :yes:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.