Sql Query
Ik heb de volgende Sql query
Nu heb ik alleen 1 probleem.
Bij email 1 en 2 zoekt hij op de zelfde invul var. Daar staat nu AND tussen.
Nu wil ik alleen 'of' hebben. Met OR gaat dit alleen mis... iemand een idee?
Groet Johan
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
$sql2 = "SELECT * FROM persoonlijke_gegevens
WHERE Contactcode LIKE '%" . $Contactcode . "%'
AND Contactgroep LIKE '%" . $Contactgroep . "%'
AND Voornaam LIKE '%" . $Voornaam . "%'
AND Achternaam LIKE '%" . $Achternaam . "%'
AND Plaats Like '%" . $Plaats . "%'
AND Nieuwsbrief LIKE '%" . $Nieuwsbrief . "%'
AND Emailadres1 LIKE '%" . $Emailadres . "%'
AND Emailadres2 LIKE '%" . $Emailadres . "%'";
WHERE Contactcode LIKE '%" . $Contactcode . "%'
AND Contactgroep LIKE '%" . $Contactgroep . "%'
AND Voornaam LIKE '%" . $Voornaam . "%'
AND Achternaam LIKE '%" . $Achternaam . "%'
AND Plaats Like '%" . $Plaats . "%'
AND Nieuwsbrief LIKE '%" . $Nieuwsbrief . "%'
AND Emailadres1 LIKE '%" . $Emailadres . "%'
AND Emailadres2 LIKE '%" . $Emailadres . "%'";
Nu heb ik alleen 1 probleem.
Bij email 1 en 2 zoekt hij op de zelfde invul var. Daar staat nu AND tussen.
Nu wil ik alleen 'of' hebben. Met OR gaat dit alleen mis... iemand een idee?
Groet Johan
$sql2 = "SELECT * FROM persoonlijke_gegevens
WHERE Contactcode LIKE '%" . $Contactcode . "%'
AND Contactgroep LIKE '%" . $Contactgroep . "%'
AND Voornaam LIKE '%" . $Voornaam . "%'
AND Achternaam LIKE '%" . $Achternaam . "%'
AND Plaats Like '%" . $Plaats . "%'
AND Nieuwsbrief LIKE '%" . $Nieuwsbrief . "%'
AND
( Emailadres1 LIKE '%" . $Emailadres . "%'
OR Emailadres2 LIKE '%" . $Emailadres . "%')";
WHERE Contactcode LIKE '%" . $Contactcode . "%'
AND Contactgroep LIKE '%" . $Contactgroep . "%'
AND Voornaam LIKE '%" . $Voornaam . "%'
AND Achternaam LIKE '%" . $Achternaam . "%'
AND Plaats Like '%" . $Plaats . "%'
AND Nieuwsbrief LIKE '%" . $Nieuwsbrief . "%'
AND
( Emailadres1 LIKE '%" . $Emailadres . "%'
OR Emailadres2 LIKE '%" . $Emailadres . "%')";