changed css to use class's
css is in a block at the top, (will be moved to a css file when im done)
fixed the ' and " (I hope)
$row['type'] holds 1 of 5 values which im going to use to change the bgcolor
final </tr> I missed putting back in as I was experimenting having it at the start and end of the row :$
$row['type'] still holding the last row value and not the row value (still too dumb to work out what im missing)
applying for a bank loan to pay for the beer I owe mac_gyver
<div style=' height:800px; overflow:auto;'>
<table class='hovertable' cellspacing'0' cellpadding='0' border='1' >
<thead>
<?php
$sql = "SELECT tank_list.name_i18n,
tank_list.tank_id,
tank_list.name,
tank_list.type,
tank_list.nation,
tank_list.short_name_i18n,
player_list.account_id,
player_list.nickname,
player_list.clan,
garage_list.tank_id IS NOT NULL AS combination_exists
FROM player_list
CROSS JOIN tank_list
LEFT JOIN garage_list
ON player_list.account_id = garage_list.account_id
AND tank_list.tank_id = garage_list.tank_id
WHERE tank_list.level = '$tier'
AND player_list.clan = '$clanname'
ORDER BY FIELD(tank_list.type, 'lighttank', 'mediumTank', 'heavyTank', 'AT-SPG', 'SPG'), name ASC,
tank_list.name ASC,
tank_list.nation ASC,
player_list.nickname ASC ";
$result = $conn->query($sql);
$rows = $result->fetch_all(MYSQLI_ASSOC);
$data = array();
foreach ($rows as $row)
{
$data[$row['short_name_i18n']][$row['nickname']] = ($row['combination_exists'] == 1);
}
if(empty($data)){
echo "Please select again, no players found matching your search";
} else {
$firstTank = reset($data);
$players = array_keys($firstTank);
$array = array_keys($firstTank);
$count = count($array);
echo '<tr><th width="170" ></th>';
for ($i = 0; $i < $count; $i++) {
echo '<th><img src="./img/name/vrt'.$array[$i].'.png" title="'.$array[$i].'"></th>';
//echo "<td>".$array[$i] . "\n</td>";
}
echo '</tr></thead></div><tbody>';
foreach($data as $tank_name=>$arr){
echo '<tr><td><div class="'.$row['type'].'">'.$tank_name. '</div><div class="right">' . array_sum($arr).'</div></td>'; // tank name as row label
foreach($arr as $nickname=>$element){
// output the data for each cell
if ($element == 1){
echo '<td><img src="./img/' . $element . '.png" height="20" width="20" title="' . $nickname . '"></td>';
}else{
echo "<td></td>";
}
}
echo '</tr>';
// may use this later
//echo '<td><div class="right">'. array_sum($arr) .'</div></td></tr>';
}
}
?>
</tbody>
</table></div>
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.