Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/04/2008, 13:46
lauchalp95
 
Fecha de Ingreso: julio-2006
Mensajes: 254
Antigüedad: 17 años, 10 meses
Puntos: 0
Como imprimir 'esto' de la variable sum! No entiendo :s

Bueno, yo tengo una página donde se deben sumar los valores de todos los registros de la tabla usuarios, pero se deben sumar solo los que son de un mismo equipo... osea que debo sumar todos los del equipo1,equipo2,equipo3,equipo4. Tengo este codigo, lo que yo no se es como poner con un echo en el sitio la suma de cada uno:
Cita:
Conexion
HTML
PHP
Zona del problema
<?php
Conexion
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_PotterHispano, $PotterHispano);
$query_suma = "SELECT casa, sum( puntos_propios ) as puntos_totales FROM `usuarios` GROUP BY casa";
$suma = mysql_query($query_suma, $PotterHispano) or die(mysql_error());
$row_suma = mysql_fetch_assoc($suma);
$totalRows_suma = mysql_num_rows($suma);

?><? $_COOKIE['MM_Username'] = $usuario; ?>


<!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=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<link href="/estilos.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
}
-->
</style></head>

<body>
<div id="apDiv1"><iframe scrolling="no" height="1450" width="560" src="/noticias.php" name="c"></iframe></div>
<div id="apDiv2">
<div align="center">
<p><img src="/botones/puntos.png" width="150" height="50" /></p>
<table width="176" border="0">
<tr>
<td><div align="center">.:Gry:.</div></td>
<td><div align="center">.:Sly:.</div></td>
<td><div align="center">.:Huf:.</div></td>
<td><div align="center">.:Rav:.</div></td>
</tr>
<tr>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
</table>
<p><img src="/botones/revista.png" width="150" height="50" /><img src="/botones/libros.png" width="150" height="50" /><img src="/botones/afiliados.png" width="150" height="50" /></p>
</div>
<div align="center">
<p>&nbsp;</p>
</div>
</div>
<div id="apDiv3"><img src="/botones/ph.png" width="150" height="50" /><img src="/botones/ultimas.png" width="150" height="50" /><img src="/botones/hora.png" width="150" height="50" /><img src="/botones/peliculas.png" width="150" height="50" /></div>
<table width="986" border="0" background="/layout.jpg" id="todo">
<tr>
<td height="347" colspan="3">&nbsp;</td>
</tr>
<tr>
<td height="55" colspan="3"><div align="center">Avisos para hoy: El sitio sigue en construccion.</div></td>
</tr>
<tr>
<td height="63" colspan="3"><div align="center"><a href="/index.php">Home</a> - <a href="/menuprincipal/casas.php" target="c">Casas</a> - <a href="/menuprincipal/clases.php" target="c">Clases</a> - <a href="/menuprincipal/contacto.php" target="c">Contacto</a> - <a href="/menuprincipal/copa.php" target="c">Copa</a> - <a href="/menuprincipal/staff.php" target="c">Staff</a></div></td>
</tr>
<tr>
<td height="65" colspan="3"><div align="center"><a href="/menuusuarial/hacertarea/tarea.php" target="c">Tarea</a> - <a href="/menuusuarial/notas/index.php" target="c">Notas</a> - <a href="/menuusuarial/perfil/perfil.php" target="c">Mi perfil</a> - <a href="/menuusuarial/recapitulativo/puntos.php" target="c">Puntos </a></div></td>
</tr>
<tr>
<td width="201" height="1464">&nbsp;</td>
<td width="564"><p>&nbsp;</p>
</td>
<td width="207">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

<?php
mysql_free_result($suma);
?>