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