Kronos9326 Posted April 6, 2006 Share Posted April 6, 2006 [code]<table width="100%" border="0" cellpadding="0" cellspacing="0" class="BodyText"> <?php do { ?> <tr> <td class="SmallText"><font color="#999999">RELEASED:</font> <a href="<?php echo $row_new['homepage']; ?>"><?php echo $row_new['name']; ?></a></td> </tr> <?php } while ($row_new = mysql_fetch_assoc($new)); ?> </table>[/code]I've got the above script/query (and several others like it) that I would like to run every 20 minutes and write the contents to a text file. I would then include that file in various parts of the website. I am doing this to reduce the 'strain' of our DB server, since we've already run into problems with us running out of available connections.Our server is running PHP version 4.3.11. Can anyone help me with a simple PHP script that would do what I'm looking for. From there I'd apply to to the other queries I have running.Any help would be appreciated.David. Quote Link to comment Share on other sites More sharing options...
DrDre Posted April 6, 2006 Share Posted April 6, 2006 Read reply below... Theres some code in these forums added by phpfreaks which is blocking the code needed :x Quote Link to comment Share on other sites More sharing options...
Kronos9326 Posted April 6, 2006 Author Share Posted April 6, 2006 [!--quoteo(post=362112:date=Apr 5 2006, 10:15 PM:name=DrDre)--][div class=\'quotetop\']QUOTE(DrDre @ Apr 5 2006, 10:15 PM) [snapback]362112[/snapback][/div][div class=\'quotemain\'][!--quotec--]hmm? 403 Forbidden on post[/quote]I don't understand.. what's this got to do with my question?David. Quote Link to comment Share on other sites More sharing options...
DrDre Posted April 6, 2006 Share Posted April 6, 2006 [code]<?//mysql stuff to get $newob_start();?><table width="100%" border="0" cellpadding="0" cellspacing="0" class="BodyText"> <?php do { ?> <tr> <td class="SmallText"><font color="#999999">RELEASED:</font> <a href="<?php echo $row_new['homepage']; ?>"><?php echo $row_new['name']; ?></a></td> </tr> <?php } while ($row_new = mysql_fetch_assoc($new)); ?> </table><?$content = ob_get_contents();ob_end_clean();$f=fo pen('myfile.txt','a');fwr ite($f,$content);fcl ose($f);?>[/code]Save to a php file, then look into Cron Jobs (google it if you need to)And setup a cron job to run php /path/to/file.php (and some other parameter i cant remember) every 20 minWow... odd..the staff here has some special code that throws 403 forbidden if you try to type code that accesses files...namely the fw rite coderemove the spaces from the file writing functions.testingfputs(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.