[PHP] Schoolspullen

Gestart doorShahiem11 reacties50 weergaven

12 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,

Ik heb een school spullen script maar hij bugt nu opeens. Net deed hij het nog perfect, maar als ik bijvoorbeeld 2 gewaden heb dan zet hij een streep door de drie gewaden. Terwijl ik 2 gewaden heb i.p.v. 3.

Kan iemand helpen?

// Schoolspullen
    $schoolitemQuery = $mysql->query("SELECT id, ( SELECT 1 FROM leden_hutkoffer WHERE lid_id = ".$info[id]." AND artikel_id = hutkoffer.id GROUP BY artikel_id) gebruiker_heeft FROM leden_hutkoffer hutkoffer");
    
    $gebruiker_heeft = array();
    $gebruiker_heeft_aantal = array();
    
    while($schoolitemFetch = $mysql->fetch($schoolitemQuery))
    {
        
        $gebruiker_heeft[$schoolitemFetch[id]] = is_null($schoolitemFetch[gebruiker_heeft]) ? FALSE : TRUE;
        $gebruiker_heeft_aantal[$schoolitemFetch[id]] = ($mysql->num_rows($schoolitemQuery));
        
    }
    print_r($gebruiker_heeft);
    ?>
    <div class="titel">
        <h1>Schoolspullen</h1>
    </div>
    <div class="inhoud">
        <h3>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$school[/COLOR][COLOR= #007700];[/COLOR] ?></h3>
        
        <h4>U N I F O R M</h4>
        Eerstejaarsstudenten hebben nodig:<br /><br />
        
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]4[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$gebruiker_heeft_aantal[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]4[/COLOR][COLOR= #007700]] >=[/COLOR] [COLOR= #0000BB]3[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]);[/COLOR] ?>1. Drie effen werkgewaden (zwart)[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]4[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$gebruiker_heeft_aantal[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]4[/COLOR][COLOR= #007700]] >=[/COLOR] [COLOR= #0000BB]3[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]);[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]5[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>2. E&eacute;n effen puntmuts (zwart) voor schooltijd[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]5[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>3. E&eacute;n paar beschermende handschoenen (drakenhuid of soortgelijk)[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]3[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>4. E&eacute;n wintermantel (zwart, met zilveren speld)[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]3[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE  [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        N.B.: Alle kledingstukken moeten van naamlabels zijn voorzien

        <h4>V E R P L I C H T E   L E C T U U R</h4>
        Alle leerlingen moeten in het bezit zijn van de volgende werken:<br /><br />
        
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>Het Standaard Spreukenboek (Niveau 1) door Miranda Wiggelaar[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]7[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>De Geschiedenis van de Toverkunst door Mathilda Belladonna[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]7[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]8[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>Theoretische Grondslagen der Magie door Adalbert Zwatel[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]8[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]9[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>Gedaanteverandering: een Boek voor Beginners door Emeric Morfo[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]9[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>Duizend Magische Kruiden en Paddenstoelen door Philippa Zwam[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]10[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]11[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>Magische Brouwsels en Drankjes door Arsenius Grein[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]11[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]12[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>Fabeldieren en Waar Ze Te Vinden door Newt Scamander[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]12[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]13[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>De Zwarte Kunsten: Een Handboek voor Zelfbescherming door Quinten Tondel[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]13[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>

        <h4>O V E R I G E   B E N O D I G D H E D E N</h4>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$info[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]toverstok[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000][/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>1 toverstaf[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$info[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]toverstok[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #DD0000][/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]14[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>1 ketel (tin, standaardmaat 2)[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]14[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]16[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]||[/COLOR] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]17[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE  [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>1 set glazen of kristallen flesjes[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]16[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]||[/COLOR] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]17[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE  [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]19[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>1 telescoop[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]19[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br />
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]18[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?>1 set koperen weegschalen[COLOR= #0000BB]<?[/COLOR]php [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$gebruiker_heeft[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]18[/COLOR][COLOR= #007700]] ==[/COLOR] TRUE [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</strike>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR] ?><br /><br />
        Leerlingen mogen tevens een uil Of een kat Of een pad meenemen.

        <h4>OUDERS WORDEN ERAAN HERINNERD DAT EERSTEJAARS GEEN EIGEN BEZEMSTELEN MOGEN BEZITTEN.</h4>
0
Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Met een if

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruiker_heeft[/COLOR] [COLOR= #007700]==[/COLOR] true[COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Dit pruduct heeft u al[/COLOR][COLOR= #007700];
}[/COLOR]

?>
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Daar was ik ook al opgekomen.emo Ik bedoel ene makkelijke manier
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Hoe genereer je deze array: $gebruiker_heeft?
kan je er wat meer over vertellen?
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Je kan een foreach doen.

[COLOR= #0000BB]<?php

$nodigarray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]3[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]7[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$nodigarray[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$key[/COLOR] [COLOR= #007700]=>[/COLOR] value[COLOR= #007700])
{[/COLOR]
    [COLOR= #FF8000]// check of de $key in $gebruiker_heeft staat[/COLOR]
[COLOR= #007700]}[/COLOR]

?>


Dat bespaart je in ieder geval weer een stuk code.
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
Je kan een foreach doen.
[COLOR= #0000BB]<?php

$nodigarray[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]3[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]6[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]7[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$nodigarray[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$key[/COLOR] [COLOR= #007700]=>[/COLOR] value[COLOR= #007700])
{[/COLOR]
    [COLOR= #FF8000]// check of de $key in $gebruiker_heeft staat[/COLOR]
[COLOR= #007700]}[/COLOR]

?>


Dat bespaart je in ieder geval weer een stuk code.

Dankje, het moet trouwens $value zijn die ik moet controleren
Enhoe kan ik dan ook gelijk de aantallen controleren: $gebruiker_heeft_aantal. Moet ik dan een multi dimensionale array maken?
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Ik zou het zo laten. Je hebt teveel verschillende setjes in je scriptje (soms moet je alleen het item hebben, soms moet je er minimaal x van hebben, soms moet je de ene óf de andere hebben, soms moet je ze allebei hebben), je werkt met categoriën en je hebt hier en daar een tekst die je onder de categorie wil zetten.
Je kunt het allemaal in een database verwerken, maar dat wordt best wat extra werk.

Het enige wat ik zou veranderen is een functie maken die zelf de en neerzet, dat maakt je script wat overzichtelijker. Maar de checks zou ik lekker zo laten.

edit; ik neem aan dat je in je systeem een keer moet weten of de gebruiker voldoende spullen heeft, en daar kun je dan wel een functie voor maken. Je geeft dan $gebruiker_heeft en $gebruiker_heeft_aantal mee als argumenten en checkt dan in de functie of hij overal voldoende van heeft.
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$leerjaareenSpullen = array(1 => 1, 2 => 1, 3 => 1, 4 => 3, 5 => 1, 6 => 1, 7 => 1, 8 => 1, 9 => 1, 10 => 1, 11 => 1, 12 => 1, 13 => 1, 14 => 1, 16 => 1, 18 => 1, 19 => 1);
            foreach($leerjaareenSpullen as $key => $aantal)
            {
            
                if($gebruiker_heeft[$key] == TRUE && $gebruiker_heeft_aantal[$key] >= $aantal)
                {
                
                    $heeftSpullen = 1;
                    
                }
                else
                {
                    
                    $heeftSpullen = 0;
                    
                }
                
            }


Ik heb nu dit, en het werkt smile
toevoeging op 1 maart 2012, 141207:
Er komen nog wel meer schooljaren, maarja. Dat komt later wel emo
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nog een foutje sadley
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Shahiem schreef:
Nog een foutje sadley
Welke dan?
0
Berichten
9.953
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dude, lees de startpost? emo
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het is al gelukt santabaard
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren