PHP ver gevorderde |
|
Ik wil laten checken of ik alles heb. Dit is de code:
<?php
//Haal alle producten op en tel ze
$query2 = "SELECT `productid`, `aantal` FROM `user_producten` WHERE `userid`='".$_COOKIE['id']."'";
$result2 = mysql_query($query2) or die(mysql_error());
$fetch2 = mysql_fetch_array($result2);
//Als je niet alle producten hebt of je hebt prodctid 23 niet 3 keer
//PS: De enters staan er in het echt niet, dit is voor deze pagina overzichtelijker te maken.
if($fetch2['productid'] != 23 ||
($fetch2['productid'] == 23 && $fetch2['aantal'] <= 3) ||
$fetch2['productid'] != 24 || $fetch2['productid'] != 25 ||
$fetch2['productid'] != 26 || $fetch2['productid'] != 27 ||
$fetch2['productid'] != 29 || $fetch2['productid'] != 34 ||
$fetch2['productid'] != 35 || $fetch2['productid'] != 36 ||
$fetch2['productid'] != 37 || $fetch2['productid'] != 38 ||
$fetch2['productid'] != 39 || $fetch2['productid'] != 40 ||
$fetch2['productid'] != 62 || $fetch2['productid'] != 73 ||
$fetch2['productid'] != 80 || $fetch2['productid'] != 81 ||
($fetch2['productid'] != 1 || $fetch2['productid'] != 2 ||
$fetch2['productid'] != 3 || $fetch2['productid'] != 4 ||
$fetch2['productid'] != 5 || $fetch2['productid'] != 6 ||
$fetch2['productid'] != 7 || $fetch2['productid'] != 8) ||
($fetch2['productid'] != 78 || $fetch2['productid'] != 79))
{
echo "Je hebt niet alle producten.";
}
?>
<?php //Haal alle producten op en tel ze $query2 = "SELECT `productid`, `aantal` FROM `user_producten` WHERE `userid`='".$_COOKIE['id']."'"; //Als je niet alle producten hebt of je hebt prodctid 23 niet 3 keer //PS: De enters staan er in het echt niet, dit is voor deze pagina overzichtelijker te maken. if($fetch2['productid'] != 23 || ($fetch2['productid'] == 23 && $fetch2['aantal'] <= 3) || $fetch2['productid'] != 24 || $fetch2['productid'] != 25 || $fetch2['productid'] != 26 || $fetch2['productid'] != 27 || $fetch2['productid'] != 29 || $fetch2['productid'] != 34 || $fetch2['productid'] != 35 || $fetch2['productid'] != 36 || $fetch2['productid'] != 37 || $fetch2['productid'] != 38 || $fetch2['productid'] != 39 || $fetch2['productid'] != 40 || $fetch2['productid'] != 62 || $fetch2['productid'] != 73 || $fetch2['productid'] != 80 || $fetch2['productid'] != 81 || ($fetch2['productid'] != 1 || $fetch2['productid'] != 2 || $fetch2['productid'] != 3 || $fetch2['productid'] != 4 || $fetch2['productid'] != 5 || $fetch2['productid'] != 6 || $fetch2['productid'] != 7 || $fetch2['productid'] != 8) || ($fetch2['productid'] != 78 || $fetch2['productid'] != 79)) { echo "Je hebt niet alle producten."; } ?>
Dus er moet gecheckt worden of ik al die producten heb en als je ziet staan || ($fetch2['productid'] != 1 || $fetch2['productid'] != 2) etc wil dat zeggen dat je oftewel 1, of 2 , etc hebt totals ) terug wordt afgesloten. Ik krijg altijd dit:
Je hebt niet alle producten.
Ook al heb ik ze allemaal. Wat is er fout?
|