title: mysqli_connect difference to mysql_connect
body: <p>I need to convert php 5 code to php7.
  All mysql statements are converted using a script that defines such functions:</p>
  
  <pre><code>function mysql_connect($host, $username, $password){
      global $dbconnect;
      $dbconnect = mysqli_connect($host, $username, $password);
      return $dbconnect;
  }
  </code></pre>
  
  <p>The nice thing is - it works on php7.</p>
  
  <p>Now I rewrote all scripts using mysqli_connect instead.
  However then the first function using mysqli fails.</p>
  
  <pre><code>mysqli_connect(): (HY000/1044): Access denied for user 
  </code></pre>
  
  <p>If I switch back to <code>mysql_connect</code> it works and fails again at the next mysqli command.</p>
  
  <p>Why?</p>
  
  <p>EDIT:
  full code of the connect:</p>
  
  <pre><code>function db_connect() 
  {
      global $db_sql_hostname,$db_sql_database,$db_sql_user,$db_sql_password;
      require_once 'db-config.php';
      global $db_handle;    
      $db_handle = mysqli_connect($db_sql_hostname, $db_sql_user, $db_sql_password, $db_sql_database) or die("Konnte nicht zum mySQL-Server verbinden: ".mysqli_error());
      mysqli_select_($db_sql_database, $db_handle) or die("Konnte die Datenbank ".$db_sql_database." nicht oeffnen: ".mysqli_error());    
      return $db_handle;
  }
  </code></pre>
  
  <p>Note that everything works with mysql_ commands. The variables are correct!</p>
  
  <p>EDIT2: this is db-config.php</p>
  
  <pre><code>&lt;?php
    $db_sql_hostname   = "hostIP";
    $db_sql_database   = "dbname";
    $db_sql_dbuser     = "dbuser";
    $db_sql_dbpassword = "dbpassowrd";
  ?&gt;
  </code></pre>