connect_error) { die(“Connection failed: ” . $conn->connect_error); } // Get the submitted firstname value $firstname = $_POST[“firstname”]; // Execute a query based on the firstname value $sql = “SELECT id, firstname, lastname, email FROM mytable WHERE firstname=’$firstname'”; $result = $conn->query($sql); if ($result->num_rows > 0) { // Output data of each row while($row = $result->fetch_assoc()) { echo “ID: ” . $row[“id”]. ” – Name: ” . $row[“firstname”]. ” ” . $row[“lastname”]. ” – Email: ” . $row[“email”]. ” “; } } else { echo “0 results”; } $conn->close(); ?>    
   

Loading

Share