PHP如果不大于1,打印文本


PHP if not greater than 1, print text

在下面的代码中,我让服务器检查该人是否在团队中。如果它们是,它显示一些东西,如果它们不是,它显示一些不同的东西。如果这个人在一个团队中(它打印正确的东西),它就会工作,但如果这个人不在一个团队中,它就不会显示任何东西。任何帮助吗?

            if($_SESSION["username"]){
                $sql2 = mysql_query("SELECT * FROM teams WHERE game='bl2' AND players LIKE '%$sessiongamt%'") or die("Could not allocate information!");
                $num1 = 0;
                while($row = mysql_fetch_assoc($sql2)){
                  $num = ++$num;
                  $amount = mysql_num_rows($sql2);
                  $id = $row["id"];
                  $name = $row["name"];
                  $link = $row["link"];
                  if($amount < 0 || $num1 < 0){
                    print '<hr/>
                      <img src="../../img/games/black-ops-2-img.png" />
                      <h2>Black Ops 2: XBOX360</h2>
                      <hr/>
                        <div class="btn-group" style="margin-left: 210px;">
                          <a href="../findamatch.php?g=bl2" class="btn">Find a Match</a>
                          <a href="../reportamatch.php?g=bl2" class="btn">Report a Match</a>
                          <a href="../matchissue.php?g=bl2" class="btn">Match Issue</a>
                          <a href="../support.php?id=bl2" class="btn">Support</a>
                        </div>
                      <hr/>
                      <h2>Featured Teams</h2><hr/>';
                  }else{
                    print '<hr/>
                      <img src="../../img/games/black-ops-2-img.png" />
                      <h2>Black Ops 2: XBOX360</h2>
                      <hr/>
                        <div class="btn-group" style="margin-left: 210px;">
                          <a href="../findamatch.php?g=bl2" class="btn">Find a Match</a>
                          <a href="../reportamatch.php?g=bl2" class="btn">Report a Match</a>
                          <a href="../matchissue.php?g=bl2" class="btn">Match Issue</a>
                          <a href="../support.php?id=bl2" class="btn">Support</a>
                        </div>
                      <hr/>
                      <h2>Featured Teams</h2><hr/>';
                  }
              }
            }

为什么不这样一个简单的检查呢

if(isset($players) && $players < 1){
  $team = "You are not a team";
}else{
.. 
}