php - Prepare not defined -


i have tried setting sessions stored in database.i have achieved through implementing sessionhandlerinterface class.however havenot used prepared statements before want implement prepared statements in order make sql injection proof.however , when try prepare method shows me error

method prepare not defined in class

i tried extending mysqli_stmt class contains methods prepared statements.

this full code of session class stores sessions inside database.

http://codepad.org/kmlto9ym

part of code make question more clear

class syssession implements sessionhandlerinterface {    private $link;  public function open($savepath, $sessionname) {     $link = new mysqli("localhost","root","","cakenbake");     if($link){         $this->link = $link;         return true;     }else{         return false;     } } public function close() {     mysqli_close($this->link);     return true; } public function read($id) {       $result = mysqli_query($this->link,"select session_data session session_id = '".$id."' , session_expires > '".date('y-m-d h:i:s')."'");      /*$result=$this->link->prepare("some query inside")      * shows error stating prepare method not found      *      */      if($row = mysqli_fetch_assoc($result)){         return $row['session_data'];     }else{         return "";     } } 

the problem ide.it 1 showing errors.restarted ide , worked fine.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -