Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.