miércoles, 19 de noviembre de 2014

Script para extraer cantidad de tiempo transcurrido

<?php
require ("./library/conect.php");

$result = mysql_query("SELECT timediff(now(),date) AS time,date,phone,advnumber FROM `leads` where `campaign` ='o65' order by date asc");
echo "Total de records ".mysql_num_rows($result );
echo "<table border='1'>
<tr>
<th>ID</th>
<th>STATE</th>
<th>TIME</th>
<th>TIME</th>
<th>ELIMINAR</th>
</tr>";
   while($row = mysql_fetch_array($result))
    {
  echo "<tr>";
 echo "<td>" . $row['phone']."</td>";
  echo "<td>" . $row['advnumber'] . "</td>";
  echo "<td>" .  $row['time'] . "</td>";
  echo "<td>" .  substr($row['time'],-5,2). "</td>";  //extrayendo solo los minutos transcurridos
echo "<td><a href=?ID=$row[recordid]>" ."ELIMINAR" . "</td></a>";
  echo "</tr>";
$GLOBALS['b']= $row['time'];     // declaramos la Variable global para tener acceso en todo el script
}

echo "</table>";
echo $b;
mysqli_close($con);
?>

No hay comentarios:

Publicar un comentario