Hello guys im learning php and just started today. I was on yahoo web hosting and learning DB also for the first time. I was able to post a firstName and LastName into the mysql datatbase. But now i want to be able to query the name and be able to display the names which i searched. My php file isnt working and as i am not able to find the name in the database. Please i need help with it and thanks Below is my code:
<htmL>
<body>
 <p><strong>Query database</strong></p>
<form name="form1" method="post" action="backendfile2.php">
<label><br>
  <br>
 First Name
 <input type="text" name="firstname" id="firstname">
 </label>
  <p>
<label>Last Name
 <input type="text" name="lastname" id="lastname">
  </label>
  </p>
 <p> </p>
 <input type="submit" value="Submit">  
 </form>
  <p> </p>
  </body>
  </html>
php file:
   <?php
   $con=mysqli_connect("mysql","username","password","207_lab");
 // Check connection
   if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
    $firstname = mysqli_real_escape_string($con,$_POST['firstname']);
    $lastname = mysqli_real_escape_string($con,$_POST['lastname']);
     $result = mysqli_query($con,"SELECT FirstName, LastName FROM User WHERE 
      FirstName = $firstname, LastName = $lastname");
       echo "Name searched = ";
       while($row = mysqli_fetch_array($result)) {
       echo $row['FirstName'] . " " . $row['LastName'];
    echo "<br>";
        }
         ?>
 
     
     
    