Back Reply to topic
Dawormie 
(started thread)
Blue-Ribbon Chicken 
Topics: 2
Posts: 8
Playing:  Age of Conan
Ingame:  Daworm
Years registered: * * * * * * * * * * * * * * * * *
Error with 5000ms plugin? (after adding SQL) Posted: Post 02:21 Sun - Jul 27, 2008

I just got this error.

Code:

[27-Jul-2008 22:08:01] PHP Fatal error:  Call to a member function prepare() on a non-object in /home/-----/aocbot/plugins/5000ms/saveseen/index.php on line 26


Checking that file, here's the text in it.

Code:

<?php
global $Seen,$SaveSeen,$db,$dbconfig;
/******
******* load
******/
if (!is_array($Seen)) {
        say("Seen :: Loading history",1);
        $Seen=array();
        $sql = 'SELECT toon_name, last_talked FROM '.$dbconfig['dbprefix'].'seen_history';
        foreach ($db->query($sql) as $row)
        {
                if(!array_key_exists($row['toon'], $Seen))
                {
                        $Seen[$row['toon']]=strtotime($row['last_talked']);
                        say ('Seen :: loaded '.$row['toon'].' '.date('d.m.Y h:m:i',$Seen[$row['toon']]),1);
                }
        }
}

/******
******* save
******/
if (is_array($SaveSeen)) {
                $name = '';
                $now = 0;
                $Stmt1 = $db->prepare('DELETE FROM '.$dbconfig['dbprefix'].'seen_history WHERE toon_name = :name;');
                $stmt2 = $db->prepare('INSERT INTO '.$dbconfig['dbprefix'].'seen_history VALUES (:name, :time);');
                $stmt1->bindParam(':name', $name);
                $stmt2->bindParam(':name', $name);
                $stmt2->bindParam(':time', $now);
                foreach ($SaveSeen as $name=>$time)
                {
                        if ($name&&$time)
                        {
                                $now = date('Y-m-d H:i:s', $time);
                                $stmt1->execute();
                                $stmt2->execute();
                                #say ("Guildmate-Write :: $name talked on ".date("d.m.Y h:m:i",$time),1);
                        }
                }
        $SaveSeen=false;
}
?>


I'm running the SQL plugin... was running for about 40 minutes with people logging in/out without an issue. And then this popped up.
Reply with quote


Back Reply to topic