Jason Pruim wrote:
On Jun 13, 2007, at 4:03 PM, Daniel Brown wrote:
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....
}
?>
I need to learn more about arrays so I don't have to type out all of my
data! :P But first, I'll get it working and then I'll redo it. It's a
good exercise for me.
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());
?>
Currently when I try and pass the variable from viewall.php to
update.php by doing a <a href="update.php?$row[0]"> Click here!</A> I'm
getting this error:
"[Fri Jun 15 16:10:10 2007] [error] PHP Notice: Undefined index:
taskid in update.php on line 4"
and line 4 from the script looks like this:
$task_id = $_POST['taskid']; //Passed from the HTML-ized area of cron.php
Am I just totally missing something and making a very stupid newbie
mistake? Or have I stumbled onto something that is at least mildly hard?
The latter....
Your line should look like this
<a href="update.php?taskid=$row[0]"> Click here!</A>
and you grabbing line should look like this
$task_id = (int)$_GET['taskid']; //Passed from the HTML-ized area of cron.php
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.
Actually, if I am reading it right, it doesn't have too many! :)
--Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Jason "Waiting for his Top Shelf liquor" Pruim
--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php