如果我为一个人创建了至少 1 个团队,我正在努力做到这一点,它将显示团队。如果他们没有团队,它会说没有团队。如果此人至少有 1 个团队,则它有效,但如果此人不在团队中,则不会显示任何内容。我该如何解决?
<?php
$sql = mysql_query("SELECT * FROM teams WHERE players LIKE '%$sessiongamt%'") or die("Could not allocate information!");
$num = 0;
while($row = mysql_fetch_assoc($sql)){
$num = ++$num;
$amount1 = mysql_num_rows($sql);
$name = $row["name"];
$teamrank = $row["rank"];
$teamlink = $row["link"];
$players = $row["players"];
$teamid = $row['id'];
if($amount1 < 1){
$teams = "No Teams";
echo "$amount";
}else{
$teams = "$name";
echo "<a href='$teamlink?id=$teamid'>$teams</a>";
}
}print "$amount1";
?>