Bevinden op pagina=error!?

Gestart doorJvdw9 reacties35 weergaven

10 berichten · pagina 1 van 1

Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jvdw schreef:
oww, ikzit nu met een probleem, mijn nieuws word weergegeven door dit:
?p=news&id=[hierID]
maar als ik dit gebruik:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]( ([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]))  && ([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"?p=news&id="[/COLOR] [COLOR= #007700]) ) {[/COLOR]
   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je bent op de nieuwspagina"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
werkt het nietconfused
0
Berichten
3.425
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik begrijp je niet..
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ik begrijp hem wel.

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]( ([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]))  && ([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"news"[/COLOR] [COLOR= #007700]) ) {[/COLOR]
   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je bent op de nieuwspagina"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
aarclay, dus als ik dat in de code plaats, showt hij alleen Je bent op de nieuwspagina als je daar effectief bent?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Try...... thumbsup
0
Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
super bedanktbiggrinwink hiermag wel slotje op

toevoeging op 18 maart 2012, 14:30:16:
oww, ikzit nu met een probleem, mijn nieuws word weergegeven door dit:
?p=news&id=[hierID]
maar als ik dit gebruik:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]( ([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]))  && ([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"?p=news&id="[/COLOR] [COLOR= #007700]) ) {[/COLOR]
   [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Je bent op de nieuwspagina"[/COLOR][COLOR= #007700];
}[/COLOR]
?>


werkt het nietconfused
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]news[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geef een ID mee![/COLOR][COLOR= #007700];
}
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]pagina niet gevonden[/COLOR][COLOR= #007700];
}
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]home[/COLOR][COLOR= #007700];
}[/COLOR]
?>


toevoeging op 18 maart 2012, 17:40:54:
Sorry voor uitlijning emo
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
p=news&id= is geen onderdeel van één get paramater.

$_GET[id] moet je dan gebruiken.

toevoeging op 18 maart 2012, 17:45:46:
Vriendje schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]news[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geef een ID mee![/COLOR][COLOR= #007700];
}
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]pagina niet gevonden[/COLOR][COLOR= #007700];
}
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]home[/COLOR][COLOR= #007700];
}[/COLOR]
?>
toevoeging op 18 maart 2012, 17:40:54:
Sorry voor uitlijning emo
Notepad++ doet dat al een stuk beter...

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]) {[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]news[/COLOR][COLOR= #007700]) {[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]])) {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];
        }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geef een ID mee![/COLOR][COLOR= #007700];
        }
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]pagina niet gevonden[/COLOR][COLOR= #007700];
    }
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]home[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Jvdw

Lid · Topicstarter

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
er was een foutje, maar zo werkt hij wel

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]news[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"hoi"[/COLOR][COLOR= #007700];
}
}[/COLOR]

?>
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jvdw schreef:
er was een foutje, maar zo werkt hij wel

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]news[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"hoi"[/COLOR][COLOR= #007700];
}
}[/COLOR]

?>
En wat als iemand geen p parameter meegeeft? En als hij op de pagina news zit zonder een id mee te geven? Mijne is beter als jouwe, maar als je dit met elke pagina gaat doen kan je ze beter includen waarover ik je al een reactie heb gestuurd.
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