title: I can't connect my database table to my website in order to register and sign in
body: <p>My website fully functions on localhost but now that I put it on web hosting the account doesn't work, I cannot register or login. I know that it works because it previously did so there is a problem with the connection to the user table in my database. The other table with products is successfully connected. How do I fix this problem in my code?</p>
  
  <pre><code>&lt;?php
  include ('connect.php');
  $conn = connect();
  
  $email  = $_POST['Email'];
  $pass   = $_POST['Password'];
  $type   = $_POST['type'];
  
  if($type == "signup"){
      $sql = $conn-&gt;prepare("SELECT * FROM user WHERE Email like ?");
      $sql-&gt;bind_param('s', $email);
  
      $sql-&gt;execute();
      $result = $sql-&gt;get_result();
  
      if ($result-&gt;num_rows &gt; 0) {
          echo "This email is already in use"; 
      }
      else{
          /*Part 1*/
          $sqlInsert = $conn-&gt;prepare("INSERT INTO `user` (`UID`, `Email`, `Password`, `FName`, `LName`, `Country`, `City`, `Address`) VALUES (NULL, ?, ?, '', '', '', '', '');");
          $sqlInsert-&gt;bind_param('ss', $email, $pass);
  
          $sqlInsert-&gt;execute();
  
          echo "Success!";
      }
  }
  else if($type == "login"){
      $sql = $conn-&gt;prepare("SELECT * FROM user WHERE Email like ?");
      $sql-&gt;bind_param('s', $email);
  
      $sql-&gt;execute();
      $result = $sql-&gt;get_result();
  
      if ($result-&gt;num_rows &gt; 0) { 
          while($row = $result-&gt;fetch_assoc()){
              if($row["Password"] == $pass){
                  // Log in
                  session_start();
                  $_SESSION['login_user'] = $email;
                  $_SESSION['account_id'] = $row["UID"];
                  echo "Success!";
              }
              else{
                  echo "Wrong credentials!";
              }
          }
      }
      else{
          echo "Wrong credentials!";
      }
  }
  mysqli_close($conn);
  ?&gt;
  </code></pre>
  
  <p>I think the problem may be here </p>
  
  <pre><code>&lt;?php
      include 'config.php';
  
      function connect() {
          $conn = new mysqli(SERVER_NAME, USER, PASSWORD, DB_NAME);
  
          if ($conn-&gt;connect_error) die("Connection failed: " . $conn-&gt;connect_error);
          return $conn;
      }
  ?&gt;
  </code></pre>