Cron won't add new rows (plus another new issue)

Dinocanid

Artist
I'm trying to add a cron that automatically creates a new show every 5 hours. After spending forever debugging, the cron no longer throws any errors when ran. However, it doesn't actually do anything.

 

$loop = $this->DB->query(
"SELECT
`event_types`.`id`,
`event_types`.`species`
FROM
`event_types`"
);

while ($event = $this->DB->fetch($loop)) {
$eventID = $event['id'];
$species = $event['species'];
$this->DB->query(
"INSERT INTO
`shows`
(
`player_id`,
`event_id`,
`event_type`,
`entry_fee`,
`created`,
`prize`,
`species`
)
VALUES
(
101,
1,
'$eventID',
0,
CURRENT_TIMESTAMP,
100,
'$species'
)"
);
}


It's just a short and simple insert query, but the cron won't add any rows when ran.

 
Last edited by a moderator:
Copy the contents of your SQL into a variable and print it out. Then run your Cron manually and drop the SQL that your Cron job is outputting and try running it manually. It's probably a DB missing key or something like that.

 
Ok so uhhh, this new thing is unrelated to the original question but somehow the game screwed itself today. I'm getting this after logging in:

Fatal error: Cannot unset $this in /home/dreamwater/public_html/caniquusnew/src/PetGameFramework/User/Player.php on line 1272
Despite me not touching the player class or any login files at all. In fact, I hadn't touched any files in almost 2 days. This is the code it's referring to:

Code:
    public function logout()
    {
        $this->DB->query(
            "UPDATE
                `" . $this->table . "`
            SET
                `atime` = NOW()
            WHERE
                `id` = '$this->id'"
        );

        //make sure the object is destroyed even if the session isn't removed
        unset($this);
        session_destroy();
    }
 
@Dinocanid - You can't unset $this because it's a PHP object that defines itself.  The only way to do it is to unset the variable using the object.  That will free it up.

 
Back
Top