title: Prepare not defined
body: <p>I have tried setting sessions which are stored in database.I have achieved this through implementing <em>SessionHandlerInterface</em> class.However i havenot used prepared statements before but now i  want to implement prepared statements in order to make it sql injection proof.However , when i try the prepare method it shows me an error </p>
  
  <blockquote>
    <p>Method Prepare not defined in Class</p>
  </blockquote>
  
  <p>i even tried extending <em>mysqli_stmt</em> class which contains the methods for prepared statements.</p>
  
  <blockquote>
    <p>This is the full code of session class that stores sessions inside the database.</p>
  </blockquote>
  
  <p><a href="http://codepad.org/KmLtO9ym" rel="nofollow">http://codepad.org/KmLtO9ym</a></p>
  
  <blockquote>
    <p>Part of the code to make the question much more clear</p>
  </blockquote>
  
  <pre><code>class SysSession implements SessionHandlerInterface
  {
     private $link;
  
  public function open($savePath, $sessionName)
  {
      $link = new mysqli("localhost","root","","cakenbake");
      if($link){
          $this-&gt;link = $link;
          return true;
      }else{
          return false;
      }
  }
  public function close()
  {
      mysqli_close($this-&gt;link);
      return true;
  }
  public function read($id)
  {
  
  
      $result = mysqli_query($this-&gt;link,"SELECT Session_Data FROM Session WHERE Session_Id = '".$id."' AND Session_Expires &gt; '".date('Y-m-d H:i:s')."'");
  
      /*$result=$this-&gt;link-&gt;prepare("Some query inside")
       * This shows up an error stating prepare method not found
       *
       */
  
      if($row = mysqli_fetch_assoc($result)){
          return $row['Session_Data'];
      }else{
          return "";
      }
  }
  </code></pre>