fuzzyDCR Posted July 18, 2011 Share Posted July 18, 2011 I currently have a decent little chatbox...I have it saving in a database...Today I was temporarily suspended by my hosting company which is supposedly unlimited for exceeding there limits...Which really doesnt make sense to me. However, it is what it is...I am wondering how I would go about changing my chatbox to report to a txt file and or...how to set it up to truncate the table once every 5 hours or something similar. I know I can set it up on a cron to clear at reset each night...which just might be the best idea...But how do I go about this. Basically I am a novice coder by any means and need the help. I am willing to give a reward to those who help me if it is needed. Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 18, 2011 Share Posted July 18, 2011 (edited) Create a 5 hour cron then just do $db->query("TRUNCATE TABLE xxxxx;"); xxxxxx being the name of your chat table <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $db->query("TRUNCATE TABLE xxxxx;"); ?> Edited July 18, 2011 by illusions Quote Link to comment Share on other sites More sharing options...
fuzzyDCR Posted July 18, 2011 Author Share Posted July 18, 2011 wow...really is it that simple? Grr...See it is the simple things like this that I should be easily picking up on...Thank you. Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 18, 2011 Share Posted July 18, 2011 sorry forgot to mention call that file cron_chat.php then add the cron to your cronjobs to run in 5 hours 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.