Jump to content

[SOLVED] Cron Jobs


supanoob

Recommended Posts

i have the following code:

 

<?php
$dbh=mysql_connect ("localhost", "meh", "mehpass") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("meh");

$query="select account_travel from accounts";
$result=mysql_query($query);
if (!$result)
{
die(mysql_error());
}
$num_rows=mysql_num_rows($result);

while ($row=mysql_fetch_array($result))
{

$account_travel=($row['account_travel']);


$sql2="UPDATE accounts SET account_travel=account_travel-1 where account_travel > '1'";
if(mysql_query($sql2))
{
echo $sql2;
}
}
?>

 

but it doesnt work, when i get an email it just says:

 

Status: 404 Not Found

X-Powered-By: PHP/5.2.5

Content-type: text/html

 

No input file specified.

 

the line i am using to send it on the cron job setup is as follows:

 

php -e /home/wwwcrim/etc/tavel_timer.php
Link to comment
https://forums.phpfreaks.com/topic/88585-solved-cron-jobs/
Share on other sites

You could do this entire thing without a script at all too (your script is pretty inificient, loops for no reason). Just place this as your cron job.

 

mysql -uYOURUSERNAME -pYOURPASSWORD -e 'USE meh;UPDATE accounts SET account_travel = account_travel-1 where account_travel > 1;'

Link to comment
https://forums.phpfreaks.com/topic/88585-solved-cron-jobs/#findComment-453585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.