title: PHP login page errors out with 11 errors
body: <p>I try to use login PHP and I get 11 errors back</p>
  
  <p>PHP Code</p>
  
  <pre><code>&lt;?php 
  $link = mysqli_connect("localhost", "root", "", "login");
  $username = isset($_POST['username']) ? $_POST['username'] : '';
  $password = isset($_POST['password']) ? $_POST['password'] : '';
  
  // To prevent mysql injection
  $username = mysqli_real_escape_string($con, $username);
  $password = mysqli_real_escape_string($con, $password);
  
  // Query the database for user
  
  $sql = "select * from users where username = ? and password = ?";
  mysqli_stmt_bind_param($stmt, 'ss', $username, $password);
  $result = mysqli_query($con,$sql) or die('Failed to query 
  database'.mysqli_error($con));
  
  $row = mysqli_fetch_array($result);
  if ( $row['username'] == $username &amp;&amp; $row['password'] == $password ){
  echo "login success! Welcome".$row['username'];
  } else {
  echo "Failed to login!";
  </code></pre>
  
  <p>When I go to login these are the errors I get ( the 1st error says unknow database login, but thats what my database is called</p>
  
  <blockquote>
    <p>( ! ) Warning: mysqli_connect(): (HY000/1049): Unknown database
    'login'     in C:\wamp64\www\Login\process.php on line 2    Call Stack
      Time    Memory  Function    Location    1   0.0002  401664  {main}( )   ...\process.php:0    2  0.0002  401664  mysqli_connect (
    ) ...\process.php:2</p>
    
    <p>( ! ) Notice: Undefined variable: con in
    C:\wamp64\www\Login\process.php     on line 7    Call Stack<br>
      Time    Memory  Function    Location    1   0.0002  401664  {main}( )   ...\process.php:0</p>
    
    <p>( ! ) Warning: mysqli_real_escape_string() expects parameter 1 to
    be     mysqli, null given in C:\wamp64\www\Login\process.php on line 7
    Call Stack    #   Time    Memory  Function    Location<br>
    1 0.0002  401664  {main}( )   ...\process.php:0<br>
    2 0.0031  402632  mysqli_real_escape_string ( )   ...\process.php:7</p>
    
    <p>( ! ) Notice: Undefined variable: con in
    C:\wamp64\www\Login\process.php     on line 8    Call Stack<br>
      Time    Memory  Function    Location    1   0.0002  401664  {main}( )   ...\process.php:0</p>
    
    <p>( ! ) Warning: mysqli_real_escape_string() expects parameter 1 to
    be     mysqli, null given in C:\wamp64\www\Login\process.php on line 8
    Call Stack    #   Time    Memory  Function    Location<br>
    1 0.0002  401664  {main}( )   ...\process.php:0<br>
    2 0.0047  402744  mysqli_real_escape_string ( )   ...\process.php:8</p>
    
    <p>( ! ) Notice: Undefined variable: stmt in
    C:\wamp64\www\Login\process.php     on line 13    Call Stack<br>
      Time    Memory  Function    Location    1   0.0002  401664  {main}( )   ...\process.php:0</p>
    
    <p>( ! ) Warning: mysqli_stmt_bind_param() expects parameter 1 to be<br>
    mysqli_stmt, null given in C:\wamp64\www\Login\process.php on line 13 
    Call Stack    #   Time    Memory  Function    Location<br>
    1 0.0002  401664  {main}( )   ...\process.php:0<br>
    2 0.0062  402792  mysqli_stmt_bind_param ( )  ...\process.php:13</p>
    
    <p>( ! ) Notice: Undefined variable: con in
    C:\wamp64\www\Login\process.php     on line 14    Call Stack<br>
      Time    Memory  Function    Location    1   0.0002  401664  {main}( )   ...\process.php:0</p>
    
    <p>( ! ) Warning: mysqli_query() expects parameter 1 to be mysqli,
    null     given in C:\wamp64\www\Login\process.php on line 14    Call
    Stack    #    Time    Memory  Function    Location    1   0.0002  401664  {main}(
    ) ...\process.php:0    2  0.0079  402792  mysqli_query (
    ) ...\process.php:14</p>
    
    <p>( ! ) Notice: Undefined variable: con in
    C:\wamp64\www\Login\process.php     on line 14    Call Stack<br>
      Time    Memory  Function    Location    1   0.0002  401664  {main}( )   ...\process.php:0</p>
    
    <p>( ! ) Warning: mysqli_error() expects parameter 1 to be mysqli,
    null     given in C:\wamp64\www\Login\process.php on line 14    Call
    Stack    #    Time    Memory  Function    Location    1   0.0002  401664  {main}(
    ) ...\process.php:0    2  0.0099  402792  mysqli_error (
    ) ...\process.php:14    Failed to query database</p>
  </blockquote>
  
  <p>DB
  <img src="https://i.stack.imgur.com/s6bMs.png" alt="DB"></p>
  
  <p>DB NEW
  <img src="https://i.stack.imgur.com/FE34k.png" alt="DB NEW"></p>