Ver Mensaje Individual
  #3  
Antiguo 07-03-2012
georkis georkis is offline
Miembro
 
Registrado: abr 2008
Ubicación: Cuba
Posts: 39
Reputación: 0
georkis Va por buen camino
Hola de nuevo... incorporé la function array_sum();

Código PHP:
<?php
$server
='localhost';
$username='root';
$pass='konter';
$db='usuario';

if(!
$conn=@mysql_connect($server$username$pass)){
    echo 
'Error al conectarse con MySQL';
}
if(!@
mysql_select_db($db$conn)){
echo 
'Error al seleccionar la base de datos';
}

$sql="SELECT
  cast(reg_serv.fecha_final as time) AS Hora_salida,
  cast(reg_serv.fecha_inicio as time) AS Hora_entrada
  
FROM
  reg_serv
  "
;
 if(!
$result=@mysql_query($sql$conn)){
     echo 
'Error en la consulta';
     }
 
$row=mysql_fetch_array($result);
?>
<table>
<tr>
<td>Resultado</td>

</tr>
Código PHP:
<?php

do { 
$total_cantidad=array ();
$total_cantidad[]=$row['Hora_salida'];

?>
<tr>

<td>
Código PHP:
<?php echo $totaldate("H:i:s"strtotime("00:00:00") + strtotime($row['Hora_salida']) - strtotime($row['Hora_entrada'])); ?>
Código PHP:
<?php $total= array(date("H:i:s"strtotime("00:00:00") + strtotime($row['Hora_salida']) - strtotime($row['Hora_entrada']))); ?>
</td>

</tr>
Código PHP:
<?php }while($row=mysql_fetch_array($result)); ?>
</table>
Total horas:<?php echo array_sum($total); ?>
Código PHP:
<?php
mysql_free_result
($result);
?>
Responder Con Cita