AzeS Posted August 9, 2016 Share Posted August 9, 2016 I try to set up a session for an chat betwen two users as i try to establish it it throws out following error message : Fatal error: Call to undefined method SPOP::prepare() in D:\XAMPPmm\htdocs\***\CORE\ADM.php on line 219 Callout: if (isset($_POST['submitcon'])) { $UID = $userRow['userId']; $TARGET = $_POST['uid']; $SID = $UID . $TARGET; $res0 = $SPOP->establishsession($UID,$TARGET,$SID,0); } ADM.php: public function establishsession($UID,$TARGET,$SID,$STMT) { # func zum establieren von chats so das der nutzter einen chat bekommt (SESSION SETUP) switch ($STMT) { case 0: # establish try { $sql = $this->prepare("INSERT INTO csessionsub(FROM_,TO,SESSID) VALUES(:f,:t,:s)"); $sql->execute(array(':f' => $UID, ':t' => $TARGET, ':s' => $SID)); return 1; } catch (PDOException $ex) { echo $ex->getMessage(); return 0; } break; case 1: # delete try { $sql = $this->prepare("DELETE FROM csessionsub WHERE SESSID=:s"); $sql->bindparam(":s", $SID); $sql->execute(); return 1; } catch (PDOException $ex) { echo $ex->getMessage();# return 0; } break; default: return 0; break; } } Any sugestions ? Quote Link to comment Share on other sites More sharing options...
Solution Jacques1 Posted August 9, 2016 Solution Share Posted August 9, 2016 You're trying to call $this->prepare() within your SPOP object (whatever that may be), but it doesn't have a prepare() method. I'm sure you actually meant something like this: $this->db->prepare(...) ^^^^ or whatever the attribute with the PDO instance is called Quote Link to comment Share on other sites More sharing options...
AzeS Posted August 9, 2016 Author Share Posted August 9, 2016 Ooooh i gues i coded to long for this day i might take a break... but thanks, solved... ^^ Quote Link to comment 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.