title: mysql_connect vs mysqli_connect
body: <p>i'm having a bit of an issue trying to use mysqli_connect the same way i use mysql_connect</p>
  
  <p>this would be an example of my code:</p>
  
  <p><strong>QUERY.PHP</strong></p>
  
  <pre><code>class classQuery{
    public function __construct(){
      require('conex/classConex.php');
      require('conex/statement/classStatement.php');
      $this-&gt;ObjConex = new classConex;
      $this-&gt;ObjStatement = new classStatement;
    }
    public function Query($email){
      $this-&gt;ObjConex-&gt;Conex();
      $query='SELECT user_email from table where email='.mysql_real_escape_string($email).'';
      $consulta = $this-&gt;ObjStatement-&gt;Select($query);
      return $consulta;
    }
  </code></pre>
  
  <p><strong>CLASS STATEMENT</strong></p>
  
  <pre><code>class classStatement{
    public function __construct(){
      $this-&gt;ObjConex = new classConex;
    }
      public function Select($query){
        $query_execute = mysql_query($query);
        while($row = mysql_fetch_row($query_execute)){
           $consulta=htmlentities($row[0]);
        }
        return $consulta; 
      }
  }
  </code></pre>
  
  <p><strong>CLASS CONEX</strong></p>
  
  <pre><code>class classConex{
    public function Conex(){
      require ('conex.php');
      mysql_connect ($server,$dbuser,$dbpasswd) or die('Error de Conexión');
      mysql_select_db($dbname);
    }
  }
  </code></pre>
  
  <p>Ok, now i want to use mysqli_connect instead of mysql_connect, according to php manual my new connect class should be something like this:</p>
  
  <p><code>$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');</code></p>
  
  <p>now that my connection is an object i won't be able to execute my query from ClassStatement the same way i'm doing it, i have tested returning the object from the connect class but that means more code that i find redundant...is there a more elegant way to do this?</p>