Aureole Posted October 9, 2007 Share Posted October 9, 2007 public_html/rev/inactive.php: line 1: ?php : No such file or directory public_html/rev/inactive.php: line 2: syntax error near unexpected token `6143' public_html/rev/inactive.php: line 2: `error_reporting(6143); ' That's what I get in the E-mail from Cron Daemon everytime my cron job runs... Here's the code that the cron job runs... <?php error_reporting(6143); include('functions.swr3'); dbConnect(); $c_timestamp = time(); $query = "SELECT * FROM members WHERE mem_online='1'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $mem_id = $row['mem_id']; $mem_last_action = $row['mem_last_action']; $inactivity = $c_timestamp - $mem_last_action; if($inactivity > 3600) { $query = "UPDATE members SET mem_online='0' WHERE mem_id='{$mem_id}'"; $result = mysql_query($query); } } ?> Help! ??? ??? ??? Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/ Share on other sites More sharing options...
haaglin Posted October 9, 2007 Share Posted October 9, 2007 What is the command your cron is running? Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365356 Share on other sites More sharing options...
Aureole Posted October 9, 2007 Author Share Posted October 9, 2007 I fixed it the command is now: /usr/local/bin/php -q /home/veraci7y/public_html/rev/inactive.php and the code is the same and I'm getting: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/veraci7y/public_html/rev/inactive.php on line 12 ...but it looks fine to me... Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365359 Share on other sites More sharing options...
Aureole Posted October 9, 2007 Author Share Posted October 9, 2007 Even though I'm getting that error the cron job is still running however it is not looping through the results, each time it runs it finds one guy who's online and has been inactive for more than an Hour then it signs him out, then it finishes and waits 'til next time it runs to do one more guy... ...I want it do all of them at once... Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365362 Share on other sites More sharing options...
MmmVomit Posted October 9, 2007 Share Posted October 9, 2007 That's because you're reassigning the value of $result on line 20. Use a different variable, or, since it's an update query, don't assign a variable at all and just add an "or die" after the query. Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365390 Share on other sites More sharing options...
Aureole Posted October 9, 2007 Author Share Posted October 9, 2007 My code is now this, it gives me a white screen - what gives? <?php include('functions.swr3'); dbConnect(); $c_timestamp = time(); $query = "SELECT * FROM `members` WHERE mem_online='1'"; $result = mysql_query($query) or die(mysql_error()); if($result) { while($row = mysql_fetch_assoc($result)) { $mem_id = $row['mem_id']; $mem_last_action = $row['mem_last_action']; $inactivity = $c_timestamp - $mem_last_action; if($inactivity > 3600) { $query2 = "UPDATE `members` SET mem_online='0' WHERE mem_id='{$mem_id}'"; $result2 = mysql_query($query2) or die(mysql_error()); } } } else { echo('No inactive online members found.'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365404 Share on other sites More sharing options...
MadTechie Posted October 9, 2007 Share Posted October 9, 2007 unless functions.swr3 prints something, a white screen would be good! as the only thing you have that prints to the screen are errors! maybe update the end to } else { echo('No inactive online members found.'); exit; } echo "Finished"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365407 Share on other sites More sharing options...
MmmVomit Posted October 9, 2007 Share Posted October 9, 2007 Tsk, tsk. echo "Finished"; } else { echo('No inactive online members found.'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365408 Share on other sites More sharing options...
trq Posted October 9, 2007 Share Posted October 9, 2007 what gives? Id'e say its working then. You output nothing on success. Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365410 Share on other sites More sharing options...
Aureole Posted October 9, 2007 Author Share Posted October 9, 2007 Yep that's it, to say how far I've came since I joined; I still make extremely dumb mistakes all the time... hmm, this calls for a poll. Thanks a lot guys. EDIT: Poll: here Quote Link to comment https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365411 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.