-2

我想要一个这样的系统:

function check()
{
      $sqlquery = mysql_query("SELECT * FROM clients WHERE id='$this->ClientID' 
            AND username='$this->ClientUSERNAME'") or die(mysql_error());
      $showmysql = mysql_fetch_array($sqlquery );
      $statusOK = $showmysql['status'];
      if ($statusOK == "Active" || "1");{
         return true;
      }
      else if ($statusOK == "Pending");{
           $this->Redirect("pending.php");
      }
      else if ($statusOK == "Susspended");{
           $this->Redirect("sus.pjp");
      }
}

但是当我把这段代码放在 adobe dreamweaver 中时,我看到了......(})的问题是什么?请写下真正的代码

4

4 回答 4

1

将分号删除到您的条件中,例如if, else if

<?php
function check()
{
    $sqlquery = mysql_query("SELECT * FROM clients WHERE id='$this->ClientID'
      AND username='$this->ClientUSERNAME'") or die(mysql_error());
    $showmysql = mysql_fetch_array($sqlquery );
    $statusOK = $showmysql['status'];
    if ($statusOK == "Active" || "1")
    {
       return true;
    }
    else if  ($statusOK == "Pending")
    {
       $this->Redirect("pending.php");
    }
    else if ($statusOK == "Susspended"){
       $this->Redirect("sus.pjp");
    }
}
?>
于 2013-10-01T09:32:58.980 回答
1

;删除分号if-else

if ($statusOK == "Active" || "1");{
                                 ^
else if ($statusOK == "Pending");{
                                ^  


if ($statusOK == "Active" || "1") {

else if ($statusOK == "Pending") {
于 2013-10-01T09:35:09.520 回答
0
function check()
{
    $sqlquery = mysql_query("SELECT * FROM clients WHERE id='$this->ClientID' AND username='$this->ClientUSERNAME'") or die(mysql_error());
    $showmysql = mysql_fetch_array($sqlquery );
    $statusOK = $showmysql['status'];
    if ($statusOK == "Active" || "1") {
        return true;
    }
    else if ($statusOK == "Pending") {
        $this->Redirect("pending.php");
    }
    else if ($statusOK == "Susspended") {
        $this->Redirect("sus.pjp");
    }
}

在 if else if then 之后删除分号(;)它将起作用。试试看...

于 2013-10-01T09:40:13.137 回答
0

在 if else 条件后删除分号并在下面的代码中尝试

function check()
{
      $sqlquery = mysql_query("SELECT * FROM clients WHERE id='$this->ClientID' 
            AND username='$this->ClientUSERNAME'") or die(mysql_error());
      $showmysql = mysql_fetch_array($sqlquery );
      $statusOK = $showmysql['status'];
      if ($statusOK == "Active" || "1"){
         return true;
      }
      else if ($statusOK == "Pending"){
           $this->Redirect("pending.php");
      }
      else if ($statusOK == "Susspended"){
           $this->Redirect("sus.pjp");
      }
}
于 2013-10-01T09:51:20.590 回答