Ciao Lore,
grazie come sempre del tuo aiuto¨
si i valori di $ipuser vengono passati correttamente ma al posto del totale mi esce Resource id #5
l'echo del $sql é :
SELECT SUM(ogg_dati) AS totale FROM tb_dati WHERE usr_id='12'
mi sembra giusto ma non so dove sbaglio, riposto il codice:
Codice PHP:
<?php require_once('Connections/dbblaise.php'); ?>
<?php
$colname_userDetail = "-1";
if (isset($_GET['usr_id'])) {
$colname_userDetail = (get_magic_quotes_gpc()) ? $_GET['usr_id'] : addslashes($_GET['usr_id']);
}
mysql_select_db($database_dbblaise, $dbblaise);
$query_userDetail = sprintf("SELECT * FROM tb_dati, tb_oggetti, tb_user WHERE tb_user.usr_id = tb_dati.usr_id AND tb_oggetti.ogg_id = tb_dati.ogg_id AND tb_user.usr_id = '%s' ORDER BY tb_oggetti.ogg_name ASC", $colname_userDetail);
$userDetail = mysql_query($query_userDetail, $dbblaise) or die(mysql_error());
$row_userDetail = mysql_fetch_assoc($userDetail);
$totalRows_userDetail = mysql_num_rows($userDetail);
?>
<?php
$iduser = $_GET['usr_id'];
$sql = "SELECT SUM(ogg_dati) AS totale FROM tb_dati WHERE usr_id='$iduser'";
$result = mysql_query($sql) or die ("Errore: ".mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dettagli Utente</title>
</head>
<body>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="250"><h1>Dettagli utente</h1></td>
<td width="250"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td><h3><?php echo $row_userDetail['usr_name']; ?></h3></td>
<td><a href=index.php>Torna indietro</a></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="2"><?php do { ?>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="250"><?php echo $row_userDetail['ogg_name']; ?></td>
<td width="250"><?php echo $row_userDetail['ogg_dati']; ?></td>
</tr>
</table>
<?php } while ($row_userDetail = mysql_fetch_assoc($userDetail)); ?></td>
</tr>
</table>
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="250">Totale</td>
<td width="250"><?php echo $result;?> </td>
</tr>
</table>
</p>
<?php echo $sql ;?></body>
</html>
<?php
mysql_free_result($userDetail);
?>
Grazie Michel