title: PHP mysql class not inserting
body: <p>I have this code:</p>
  
  <pre><code>class mysql {
  
  public $mysql;
  
  function __construct($host, $user, $pass, $db){
      $this-&gt;mysql = new mysqli($host, $user, $pass, $db);
  
      if($this-&gt;mysql-&gt;connect_errno)
          exit('Error connecting to the database');
  }
  
  public function replace(array $var){
      $str = "";
      foreach($var as $k =&gt; $v){
          $str .= substr_replace($v, "'", 0) . substr_replace ($v, "',", -1);
      }
      $str[strlen($str)-1] = "";
      return $str;
  }
  
  public function insert($table, array $kv){
      $p1 = implode(',', array_keys($kv));
      $p2 = $this-&gt;replace($kv);
      $q = "INSERT INTO $table ($p1) VALUES ($p2)";
      echo $q;
      echo $this-&gt;mysql-&gt;query($q);
  
  }
  
  
  }
  </code></pre>
  
  <p>And I use the function and no data is inserted to database I cant se anything on DB</p>
  
  <p>Output of echo:</p>
  
  <pre><code>INSERT INTO users (username,password,email) VALUES ('Hi','Hwghrwhw','WREHRWWRWRGH')
  </code></pre>