Re: HOW: save php-database query-results as html ...

From: Date: Sat, 12 Aug 2000 14:24:05 +0000
Subject: Re: HOW: save php-database query-results as html ...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-11459@lists.php.net to get a copy of this message
Hmmm... Probably should close the file pointer. so change the last few lines to $good= fwrite($fp, $stringtowrite); fclose($fp); //and echo the same results to the browser echo $stringtowrite; ?> bill wrote: > Save the file before you display the results to the browser. > > <?php > $headerstuff="<HTML><HEAD><TITLE>Query > Result</TITLE></HEAD><BODY>"; > > $footerstuff="</BODY></HTML>"; > > // do your query here > > // save your results as a string variable. > > $results="<P>blah blah blah"; > > //now save your file > > $fp = fopen("myfile.html", "w"); > > $stringtowrite=$headerstuff . $results . $footerstuff; > > $good= fwrite($fp, $stringtowrite); > > //and echo the same results to the browser > > echo $stringtowrite; > > ?> > > kind regards, > > bill > > Helmut Ott wrote: > > > I want to reduce the database-load by saving the result of a php-driven > > database-query-result to html: > > > > E.g. we made a database query and received the result list. > > If you click on an entry the specific records page is shown. > > In case this record does not change very often it makes sense to store this records page > > as html. > > > > My problem: I dont know how to make a script that does not only display the record(as a > > result of a database-query) but also save this result-page as html. Because once the rsult is shown > > the php-script was finished before (the result page is shown when the php-script has been worked > > through). > > > > Any idea around? > > > > Helmut > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#11459) next »