title: Warning: mysqli_query() expects parameter 1 to be mysqli, string given
body: <p>Let me start by saying that I've read about 15 similar threads on here and other sites trying to fix my problem before posting.</p>
  
  <p>Im testing a site with some php and mysql. Some info: </p>
  
  <p>I built the site hosted locally, then exported to 000 webhost. Is that even necessary in order to test php and mysql functions? I have a mysql database locally. Would this be causing the problems?</p>
  
  <p>I have two problems.</p>
  
  <ol>
  <li>On pages that run any php scripts i get the following warnings:</li>
  </ol>
  
  <blockquote>
    <p>Warning: virtual() has been disabled for security reasons in /home/a2575478/public_html/Login.php on line 2</p>
    
    <p>Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/a2575478/public_html/Login.php on line 37</p>
    
    <p>Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /home/a2575478/public_html/Login.php on line 37</p>
  </blockquote>
  
  <p>I know these warnings are related to mysql_* functions being deprecated but am having trouble fixing the deprecated functions</p>
  
  <p>2.</p>
  
  <p>Now, when i try to access the web pages locally, all i get is a "Webpage is not available" error. Is that due to the errors or just trying to run php locally?</p>
  
  <p>The site is reachable <a href="http://aaronwanjala.comeze.com/Login.php" rel="nofollow">here</a></p>
  
  <p>Let me know if you need any more information.</p>
  
  <p>Code below.</p>
  
  <p>Login.php</p>
  
  <pre><code>    &lt;?php @session_start(); ?&gt;
      &lt;?php virtual('/Connections/logincon.php'); ?&gt;
      &lt;?php
      if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
      {
        if (PHP_VERSION &lt; 6) {
          $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
        }
  
        $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  
        switch ($theType) {
          case "text":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;    
          case "long":
          case "int":
            $theValue = ($theValue != "") ? intval($theValue) : "NULL";
            break;
          case "double":
            $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
            break;
          case "date":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;
          case "defined":
            $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
            break;
        }
        return $theValue;
      }
      }
  
  
      $query_Login = "SELECT * FROM `user`";
      $Login = mysqli_query($logincon,$query_Login) or die(mysqli_error($logincon));
      $row_Login = mysql_fetch_assoc($Login);
      $totalRows_Login = mysql_num_rows($Login);
      mysqli_select_db($database_logincon, $logincon);
      ?&gt;
      &lt;?php
      // *** Validate request to login to this site.
      if (!isset($_SESSION)) {
        session_start();
      }
  
      $loginFormAction = $_SERVER['PHP_SELF'];
      if (isset($_GET['accesscheck'])) {
        $_SESSION['PrevUrl'] = $_GET['accesscheck'];
      }
  
      if (isset($_POST['Username'])) {
        $loginUsername=$_POST['Username'];
        $password=$_POST['Password'];
        $MM_fldUserAuthorization = "UserLevel";
        $MM_redirectLoginSuccess = "/Account.php";
        $MM_redirectLoginFailed = "/Login.php";
        $MM_redirecttoReferrer = true;
        mysql_select_db($database_logincon, $logincon);
  
        $LoginRS__query=sprintf("SELECT Username, Password, UserLevel FROM `user` WHERE Username=%s AND Password=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
  
        $LoginRS = mysql_query($LoginRS__query, $logincon) or die(mysql_error());
        $loginFoundUser = mysql_num_rows($LoginRS);
        if ($loginFoundUser) {
  
      $loginStrGroup  = mysql_result($LoginRS,0,'UserLevel');
  
      if (PHP_VERSION &gt;= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
      //declare two session variables and assign them
      $_SESSION['MM_Username'] = $loginUsername;
      $_SESSION['MM_UserGroup'] = $loginStrGroup;       
  
      if (isset($_SESSION['PrevUrl']) &amp;&amp; true) {
        $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
      }
      header("Location: " . $MM_redirectLoginSuccess );
    }
    else {
      header("Location: ". $MM_redirectLoginFailed );
    }
  }
  ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;link href="CSS/Layout.css" rel="stylesheet" type="text/css"  /&gt;
  &lt;link href="CSS/Menu.css" rel="stylesheet" type="text/css"  /&gt;
  &lt;link href="CSS/Menu.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;script src="/SpryAssets/SpryValidationTextField.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="Holder"&gt;
  &lt;div id="Header"&gt;&lt;/div&gt;
  &lt;div id="NavBar"&gt;
      &lt;nav&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;a href="Login.php"&gt;Login&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="Register.php"&gt;Register&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="ForgotPassword.php"&gt;Forgot Password&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/nav&gt;
  &lt;/div&gt;
  &lt;div id="Content"&gt;
      &lt;div id="PageHeading"&gt;
        &lt;h1&gt;Home Page &lt;/h1&gt;
      &lt;/div&gt;
      &lt;div id="ContentLeft"&gt;
        &lt;h2&gt;This is a test page for a project in progress&lt;/h2&gt;
        &lt;p&gt;&amp;nbsp;&lt;/p&gt;
        &lt;h6&gt;A work in progress.   &lt;/h6&gt;
      &lt;/div&gt;
      &lt;div id="ContentRight"&gt;
        &lt;form id="form1" name="form1" method="POST" action="&lt;?php echo $loginFormAction; ?&gt;"&gt;
          &lt;span id="sprytextfield1"&gt;
          &lt;label for="LoginForm"&gt;&lt;/label&gt;
          &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;/span&gt;
          &lt;table width="400" border="0" align="center"&gt;
            &lt;tr&gt;
              &lt;td&gt;&lt;h6&gt;&lt;span id="sprytextfield2"&gt;
                &lt;label for="Username"&gt;&lt;/label&gt;
                Username:&lt;br /&gt;
                &lt;br /&gt;
                &lt;input name="Username" type="text" class="StyleTxtField" id="Username" /&gt;
                &lt;/span&gt;&lt;/h6&gt;
              &lt;span&gt;&lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;&amp;nbsp;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;&lt;h6&gt;&lt;span id="sprytextfield3"&gt;
                &lt;label for="Password"&gt;&lt;/label&gt;
                Password:&lt;br /&gt;
                &lt;br /&gt;
                &lt;input name="Password" type="text" class="StyleTxtField" id="Password" /&gt;
                &lt;/span&gt;&lt;/h6&gt;
              &lt;span&gt;&lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;&amp;nbsp;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;&lt;input type="submit" name="LoginButton" id="LoginButton" value="Login" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;&amp;nbsp;&lt;/td&gt;
              &lt;/tr&gt;
            &lt;/table&gt;
        &lt;/form&gt;
      &lt;/div&gt;
   &lt;/div&gt;
  &lt;div id="Footer"&gt; &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
  var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
  var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  mysql_free_result($Login);
  ?&gt;
  </code></pre>
  
  <p>Logincon.php, manages the database connection</p>
  
  <pre><code>&lt;?php
  # FileName="Connection_php_mysql.htm"
  # Type="MYSQL"
  # HTTP="true"
  $hostname_logincon = "172.16.1.72:3306";
  $database_logincon = "logindb";
  $username_logincon = "root";
  $password_logincon = "boombox";
  $logincon = mysql_pconnect($hostname_logincon, $username_logincon, $password_logincon) or trigger_error(mysql_error(),E_USER_ERROR); 
  ?&gt;
  </code></pre>
  
  <p>Thanks in advance for any replies</p>