If-satsen borde vara utanför while-satsen? :)
Frågan#1
Hej!
Det är fel på min if-sats som kollar antalet spelade matcher. Finns det en obekräftad match så skriver den ut rätt. Om det inte finns någon obekräftad match så skriver den inte ut någonting.
<b>Avvaktande matcher</b><br/>
<?php
// Öppna databasen
require 'includes/database.php';
$team_id = $_SESSION[teamid];
// Räkna antalet avvaktande matcher
$get = mysql_query("SELECT * FROM rbl_games WHERE team_won_id = '$team_id' || team_lost_id = '$team_id' && team_lost_confirm = '0'");
$rowCount = mysql_num_rows($get);
// Visa endast lagets matcher som INTE är godkända
$get = mysql_query("SELECT g.*, t1.name AS won, t2.name AS lost FROM rbl_teams t1 JOIN rbl_games AS g ON g.team_won_id = t1.id JOIN rbl_teams AS t2 ON g.team_lost_id = t2.id WHERE g.team_lost_confirm = '0'");
while($row = mysql_fetch_array($get))
{
$id = $row['id'];
$team_won = $row['won'];
$team_lost = $row['lost'];
$team_won_id = $row['team_won_id'];
$team_lost_id = $row['team_lost_id'];
$team_won_rounds = $row['team_won_rounds'];
$team_lost_rounds = $row['team_lost_rounds'];
$team_won_bonus = $row['team_won_bonus'];
$team_lost_bonus = $row['team_lost_bonus'];
$team_won_report = $row['team_won_report'];
$team_lost_report = $row['team_lost_report'];
$location = $row['location'];
$date = $row['date'];
$pending = $row['pending'];
$team_lost_confirmed = $row['team_lost_confirmed'];
// Kontrollera antalet avvaktande matcher
if ($rowCount == '0')
{
echo "(inga avvaktande matcher)";
}
else
{
// Kontrollera så att man inte kan bekräfta sina egna matcher
if ($teamname == $team_won)
{
echo "$date | <b>$team_won</b> mot <b>$team_lost</b> [$team_won_rounds - $team_lost_rounds]";
}
else
{
echo "$date | <a href=lag_andra2.php?page=team_game_confirm&id=$id><b>$team_won</b> mot <b>$team_lost</b></a> [$team_won_rounds - $team_lost_rounds]";
}
}
}
// Stäng databasen
mysql_close($open);
?>