Re: Reoccurring task manager

From: Date: Wed, 13 Jun 2007 20:03:46 +0000
Subject: Re: Reoccurring task manager
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-256948@lists.php.net to get a copy of this message
[MySQL] L> Table: tasks
       L> Columns: id (auto_increment), task_name, completed,
day_of_week [PHP] L> File: viewall.php <? // .... Include files, connection routines, configuration, blah, blah, blah.... $dow = (date("N") - 1); $sql = "SELECT task_name FROM tasks WHERE completed='0'"; $sql .= " AND (day_of_week BETWEEN '0' AND '".$dow."')"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { // .... Your routine for HTML-izing the output from the database.... } ?> L> File: update.php <? // .... More include stuff, blah, blah, blah.... $task_id = $_POST['task_id']; // Passed from the "HTML-ized" area of cron.php $sql = "UPDATE tasks SET completed='1' WHERE id='".$task_id."' LIMIT 1;"; mysql_query($sql) or die(mysql_error()); ?> L> File: cronjob.php <? // .... Guess what goes here!.... $dow = (date("N") - 1); $sql = "UPDATE tasks SET completed='0' WHERE day_of_week='".$dow."''; mysql_query($sql); ?> [cron] 40 03 * * * /path/to/cronjob.php >> /dev/null 2>&1 NOTE: This was entirely typed directly into the mail client, and NONE of it was tested, so it probably has tons of bugs. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107

« previous php.general (#256948) next »