Salve,
vorrei fare qualcosa del genere:
esempio:
andrea (200 tot punti)
antonio (139 tot punti)
...
...
Riesco solo a fare vedere la lista degli utenti al momento cosi:
andrea
antonio
In sostanza vorrei mettere il totale di punti di ogni giocatore daparte al nome!!!
il db é composto cosi:
tb_user
usr_id
usr_name
tb_oggetti
ogg_id
ogg_name
tb_dati
dati_id
usr_id
ogg_id
dati_num
Riesco a fare cosi ma non é corretto;
Codice PHP:
<?php require_once('Connections/dbblaise.php'); ?>
<?php
mysql_select_db($database_dbblaise, $dbblaise);
$query_usr = "SELECT * FROM tb_user ORDER BY usr_name ASC ";
$usr = mysql_query($query_usr, $dbblaise) or die(mysql_error());
$row_usr = mysql_fetch_assoc($usr);
$totalRows_usr = mysql_num_rows($usr);
mysql_select_db($database_dbblaise, $dbblaise);
$query_totpunti = "SELECT SUM(ogg_dati) AS totale FROM tb_dati, tb_user, tb_oggetti WHERE tb_user.usr_id = tb_dati.usr_id AND tb_oggetti.ogg_id = tb_dati.ogg_id AND tb_user.usr_id='1'";
$totpunti = mysql_query($query_totpunti, $dbblaise) or die(mysql_error());
$row_totpunti = mysql_fetch_assoc($totpunti);
$totalRows_totpunti = mysql_num_rows($totpunti);
?>
<html>
<head>
<title>Statistiche</title>
</head>
<body>
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h1>Statistiche</h1></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="225"><h3>Username</h3></td>
<td width="225"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td><?php do { ?>
<table width="225" border="0" cellpadding="0" cellspacing="0" id="1">
<tr>
<td width="150">[url="detail_user.php?usr_id=<?php echo $row_usr['usr_id']; ?>"]<?php echo $row_usr['usr_name']; ?>[/url]</td>
<td></td>
</tr>
</table>
<?php } while ($row_usr = mysql_fetch_assoc($usr)); ?></td>
<td></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($usr);
mysql_free_result($totpunti);
?>