title: Web design PHP SQL Query issue
body: <p>This is one of my functions in my function.php file. Right now I'm just trying to get it to output 1 or 0 depending if the username is in the MYSQL DB.</p>
  
  <pre><code>function retrieve_single($col, $table, $item, $con) {
    require_once('include/global.php');
  
    $sql = "SELECT * FROM users WHERE username = Username1";
    $conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
    if ($conn-&gt;connect_error) { 
      trigger_error('Database connection failed: '.$conn-&gt;connect_error, E_USER_ERROR ); 
    }
    $rs=$conn-&gt;query($sql);
  
    if($rs === false) {
      trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn-&gt;error, E_USER_ERROR);
    } else {
      $rows_returned = $rs-&gt;num_rows;
      echo $rows_returned;
    }
  }
  </code></pre>
  
  <p>I keep changing stuff around trying to figure out what's wrong with it, all I know it is a sql error I keep getting. As of right now I have it written without the variables because of trying to figure out the problem.</p>
  
  <p>The global.php:</p>
  
  <pre><code>$DBServer = 'localhost'; $DBUser   = 'root'; $DBPass   = ''; $DBName   = 'social';
  </code></pre>
  
  <p>Can anyone help me out! I know the problem is simple, as this is my first time having this problem</p>