title: How to echo an item from a database
body: <p>I am still in the process of learning PHP so forgive me for the poor code. 
  I am attempting to get the users first name to output once they have logged in, however nothing is returning, please may I have some help.</p>
  
  <pre><code>   &lt;?php
  
  session_start();
  
  $DATABASE_HOST="localhost";
  $DATABASE_USER="root";
  $DATABASE_PWORD="";
  $DATABASE_NAME="registration";
  
  $connection=mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PWORD, $DATABASE_NAME);
  if (mysqli_connect_errno()){
      //if there is an issue with connecting to the database, ends code and displays the error
      die("failed to connect to server: " .mysqli_connect_error()); //kills program
  }
  
  if (!isset($_POST['email'], $_POST['pswd'])){ //checking if both fields were inputted into on the form, isset()checks if data exists
      //unable to get data
      die("please fill in both email and password"); //kills program
  }
  
  $email = mysqli_real_escape_string($connection, $_POST['email']); //saves input as string, preventing misinterpretation
  $password = mysqli_real_escape_string($connection, $_POST['pswd']);//saves input as string, preventing misinterpretation
  
  $SQLstatement = "SELECT * FROM users WHERE email='$email' and password='$password'"; //querys the database for match
  
  $Queryresult = mysqli_query($connection, $SQLstatement) or die(mysqli_error($connection)); //runs the query 
  
  $rowsQueryResult = mysqli_num_rows($Queryresult);//number of 'emails' in database where the emails match
  $dbFirstName=$rowsQueryResult ['firstName'];
      if ($rowsQueryResult==1){//if the number of emails where a match is made, is 1 
          echo "Welcome $dbFirstName &lt;br/&gt; ";
          echo "successful login. &lt;a href='accountPage.php'&gt;Click&lt;/a&gt; here to access the accounts page";      //successful login, links to accounts page
          $_SESSION['firstName']=$dbFirstName;
  
      }else{ //if matches are 0 or &gt;=2 
          die ('unsuccessful login'); //kills program
      }
  
  ?&gt;
  </code></pre>
  
  <p>Thank you for your time and help</p>