Jump to content

[SOLVED] Weird errors...


Aureole

Recommended Posts

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!  ??? ??? ???

Link to comment
https://forums.phpfreaks.com/topic/72455-solved-weird-errors/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365359
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365362
Share on other sites

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.');
}
?>

Link to comment
https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365404
Share on other sites

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";
?>

Link to comment
https://forums.phpfreaks.com/topic/72455-solved-weird-errors/#findComment-365407
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.