输出取决于当前URL的numrows

时间:2013-01-21 15:41:30

标签: php if-statement

有谁知道以下陈述应该如何?我尝试过多个结构,比如while循环和switch语句,但我无法弄明白。我知道下面的代码是完全错误的,只是想展示我想要的东西

if($numrows > 0)
  {
    if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=login.php')
      {
        $this->redirect();
      }
  }
else
  {
    echo "Wrong Username or Password!";
  }
if($numrows > 0)
  {
    if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=register.php')
      {
        echo "Already in use!";
      }
  }
else
  {
    $this->insertRows();
  }

1 个答案:

答案 0 :(得分:0)

我猜你希望逻辑是这样的,

 if($numrows > 0)
  {
      if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=login.php')           
          $this->redirect();   
      else if($this->currentURL() == 'http://localhost/webshop/public/index.php?page=register.php')  
              echo "Already in use!";                 
          else      
              echo "Wrong Username or Password!";    
  }
  else         
      $this->insertRows();