title: PHP MySql Select statement not working... Any advice?
body: <p>[UPDATED] with new code "sql_real_escape_string()"<br>
  [UPDATED] if anyone wants to look at the site its at <a href="http://synix.co.uk/beta/stanmoreform/" rel="nofollow"> Test site </a><br>
  [UPDATED] with the while code showing any results via echo</p>
  
  <p>Hello All, </p>
  
  <p>I have looked at many posts on this matter, but simply cannot understand why the following code doesn't work:</p>
  
  <pre><code>    $username = $_POST['username'];
  
      // get the record of the user, by looking up username in the database.  
      $query = sprintf("SELECT UserName, Password FROM userlogin WHERE UserName='%s'", mysql_real_escape_string($username));
  
      $result = mysqli_query($dbc, $query) or 
          die ("Error Querying Database for: " . $query . 
          "&lt;br /&gt;Error Details: " . mysql_error() . "&lt;br/&gt;" . $result);
  
  while ($row = mysqli_fetch_assoc($result))
  {
           Echo($row['UserName']);
  }
  </code></pre>
  
  <p>The Code seems to be correct... the database is working perfectly (for input purposes) and the connection is a shared connection applied with require_once('databaseconnection.php'); that is working for the registration side of things.</p>
  
  <p>like normal I'm sure this is something simple that I have overlooked but cannot for the life of me see it! </p>
  
  <p>I do not get any error messages from the myssql_error() its simply blank.</p>
  
  <p>any help would be much appreciated.</p>
  
  <p>Regards</p>