FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Php Switch Case
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Php Switch Case [message #169388 is a reply to message #169372] Thu, 09 September 2010 07:10 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 08/09/2010 20:54, jfcby escribió/wrote:
> [code]

Please do not insert bbcode tags in Usenet messages. This is it not a
fancy HTML forum.


> <?php
> $gpg = $_GET["pg"];
> $gnb = $_GET["nb"];

These values may not exist. Try this instead:

<?php

error_reporting(E_ALL);
ini_set('display_errors', TRUE);

$gpg = isset($_GET['pg']) ? $_GET['pg'] : NULL;
$gnb = isset($_GET['nb']) ? $_GET['nb'] : NULL;


> Switch ($gpg){

Perhaps it's a pet peeve of mine but my eyes bleed when I see PHP
control structures in sentence case... :)


>
> Case $gpg == 'pd'&& $gnb == 1:

Right, this is a boolean expression so it will return either TRUE or
FALSE. You can *never* get a match: even if $gpg equals 'pd' and $gnb
equals '1', the expression is TRUE, which is different from 'pd'. I
presume you want this:

http://es.php.net/manual/en/control-structures.if.php
http://es.php.net/manual/en/control-structures.else.php
http://es.php.net/manual/en/control-structures.elseif.php


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Another heredoc question
Next Topic: Downloading files, without internet renumbering...
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 17:24:48 GMT 2024

Total time taken to generate the page: 0.05238 seconds