We can use the AND operator to filter records using multiple conditions.
Let's say for example, we want to display all the email records in our database where the firstname is equal to "Ted" AND the lastname is equal to "King".
Replace your existing sql query with this line:
SELECT email FROM users
Also change your echo statement to output the email.
echo "Email: " . $row["email"]. "<br>";
This means that both conditions have to be met in order for a result to be displayed.
Looking at our database, we can see that the lastname attached to Ted is Smith. This means no records should be displayed.
Now let's change the lastname to Smith, to see the difference in output.
We can see that the email was outputted because both conditions were met.