
duda como sumar valores de columna que dependen de una busqueda
Publicado por cesar (24 intervenciones) el 11/11/2015 00:05:13
Hola muy buen dia desarrollando un soft personal trato de cargar los servicios que realizan las distintas personas filtrandolo por su numero de documento la cual funciona bien mi problema esta al tratar de sumar los valores que tienen relacion. es decir que si me carga 9 resultados me los sume todos
dejo mi codigo.
dejo mi codigo.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
include("../prueba/conexion2.php");
$link = Conectarse();
$var="";
$var1="";
$var2="";
$var3="";
if(isset($_POST["btn1"])){
$btn=$_POST["btn1"];
$bus=$_POST["txtbus"];
if($btn=="Buscar"){
$result = mysql_query("SELECT * FROM servicios WHERE Domiciliario = '$bus' ORDER BY Fecha ASC", $link);
$numero = mysql_num_rows($result);
echo "<th>Domiciliario:</th>";
echo "<td>$bus</td>";
echo "<br>";
echo "<th>Numero De Servicios:</th>";
echo "<td>$numero</td>";
echo "<br>";
echo "<th>Total:</th>";
echo "<td></td>";
echo "<table width='100%' border='1'>";
echo "<tr>";
echo "<th>Servicio</th>";
echo "<th>Cliente</th>";
echo "<th>Descripcion</th>";
echo "<th>Valor</th>";
echo "<th>Fecha</th>";
echo "</tr>";
while ($row = mysql_fetch_array($result)){
echo "<br>";
echo "<tr>";
echo "<td width='5%'>$row[0]</td>";
echo "<td width='20%'>$row[3]</td>";
echo "<td >$row[6]</td>";
echo "<td width='5%'>$row[7]</td>";
echo "<td width='19%'>$row[1]</td>";
echo "</tr>";
}
echo "</table>";
}}
?>
Valora esta pregunta


0