vendredi 23 décembre 2016

How to check multiple values in an if statement PHP

Have have some data posted to me :

test.com?firstname='John'&surname='Wick'&email='jwick@test.com'

What i want to do is check the above data with what i have in my DB, and if any of the data is the same then echo out a response and if its not the same then echo out a different response. It needs to check all 3 fields, even if 2 Dont' match and one does.

Lets assume the value's from my DB request are:

$Email = 'jwick@test.com';
$FirstName = 'John';
$Surname = 'Wick';

This is what i have tried :

if(
        $Email == $_GET['email'] &&
        $FirstName == $_GET['firstname'] &&
        $Surname == $_GET['surname']

    ){}

What happens is it only compares the $Email and ignores the rest, what is the best way to do this. Basically what i am trying to do is that is create a simple dedupe

Aucun commentaire:

Enregistrer un commentaire