$button = $button == TRUE ? "<span class='button_join'>Join</span>" : "";
Basically, if button = TRUE
, then show up the button.
But the buttons is always showing when I have $button == TRUE ?
on, but I never see it getting true anywhere?
Mysql results showing for 2 rows "In Progress", and for 1 row "Available".
But the problem is, that the button shows for every row, Ill post a picture so you will know what I am talking about:
(source: gyazo.com)
What's wrong?
This is the code:
while ($row = $query->fetch(PDO::FETCH_ASSOC))
{
if (!Ping::remote($row['server_ip'], $row['server_port']))
{
$status = "Offline";
}
else
{
$status = $row['server_status'];
}
if ($status != "In Progress" || $status != "Offline" || $status != "Full" || $status == "Available")
{
$joinButton = TRUE;
}
else
{
$joinButton = FALSE;
}
Template::drawTableRow (
$row['server_name'],
$row['server_players'],
$row['server_map'],
$row['server_status'],
$joinButton
);
}
drawTableRow
:
public static function drawTableRow($name, $players, $map, $status, $button)
{
$button = $button == TRUE ? "<span class='button_join'>Join</span>" : "";
$status = $status == "Full" || $status == "In Progress" || $status == "Offline" ? "<span class='status_error'>".$status."</span>" : "<span class='status_success'>".$status."</span>";
echo
'
<tr>
<td>
'.$name.'
</td>
<td>
'.$players.'
</td>
<td>
'.$map.'
</td>
<td>
'.$status.'
</td>
<td>
'.$button.'
</td>
</tr>
';
}
What's wrong there?