supanoob Posted January 30, 2008 Share Posted January 30, 2008 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 More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 You really don't need the -e switch there. Can you post your entire cron line? It looks fine to me. Link to comment https://forums.phpfreaks.com/topic/88585-solved-cron-jobs/#findComment-453555 Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 Oh, one thing to note is that cron has a pretty limited environment. You may need to pass the full path to the php cli binary. eg; /usr/bin/php /home/wwwcrim/etc/tavel_timer.php Link to comment https://forums.phpfreaks.com/topic/88585-solved-cron-jobs/#findComment-453558 Share on other sites More sharing options...
supanoob Posted January 30, 2008 Author Share Posted January 30, 2008 that was the whole everything, and i changed the line to be full like the one you told me, but i still get the same error thrown out. Link to comment https://forums.phpfreaks.com/topic/88585-solved-cron-jobs/#findComment-453569 Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 You sure the file is tavel_timer.php and not travel_timer.php ? Link to comment https://forums.phpfreaks.com/topic/88585-solved-cron-jobs/#findComment-453580 Share on other sites More sharing options...
supanoob Posted January 30, 2008 Author Share Posted January 30, 2008 You sure the file is tavel_timer.php and not travel_timer.php ? FFS.... how did i not miss the r missing >< i feel all noobish now thanks Link to comment https://forums.phpfreaks.com/topic/88585-solved-cron-jobs/#findComment-453581 Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.