Jump to content

Recommended Posts

ok im using cron tab 5 i guess well when ever i try to run a command it works fine but it doesnt run the file instead i get this error.

/home/mitchell/public_html/cron_min/cron_minute.php: line 1: syntax error near unexpected token `('
/home/mitchell/public_html/cron_min/cron_minute.php: line 1: `<? include("config.php");'

and when i used to use free cronjob services it ran the files perfectly

 

Link to comment
https://forums.phpfreaks.com/topic/38107-solved-cronjob/
Share on other sites

ya there it is im getting this error now

/home/mitchell/public_html/cron_min/cron_minute.php: line 1: ?: No such file or directory
/home/mitchell/public_html/cron_min/cron_minute.php: line 2: syntax error near unexpected token `"update turn set time_right=time_right-1"'
/home/mitchell/public_html/cron_min/cron_minute.php: line 2: `mysql_query("update turn set time_right=time_right-1");'

<? include "config.php";
mysql_query("update turn set time_right=time_right-1");
mysql_query("update turn set time_right=9 where time_right = -1");
mysql_query("update turn set time_left=6 where time_right = 0 and time_left = 0");
mysql_query("update turn set time_left=time_left-1 where time_right = 9");

$spell1 = mysql_query("select * from spellc");
while ($spell = mysql_fetch_array($spell1)) {
mysql_query("update spellc set time=time-1 where id=$spell[id]");

mysql_query("DELETE from spellc where id=$spell[id] and time<=1");

}
?>

Link to comment
https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182452
Share on other sites

For starters, if your trying to run php from the command line it needs a shebang line. eg;

 

#!/usr/bin/php

 

Otherwise bash won't know which program should execute the script. Second, are you sure you have short tags enabled? Use <?php instead of <?. Thirdly, that is some horrible code. There is absolutely no error handling... ever heard of an if() statement? Your code assumes that every query is successful.

Link to comment
https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182454
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.