I don't know how to compare values 0n $rVal['FechaTrx'] and $rVal['TipoMSj'].
2 points:
1) I want to see three colors in the html table (output). For the example
(like a semaphore):
$fecha5Dias = date () --> green color: Recently transactions (today)
$fecha = (date ())-5 --> yellow color: mean 5 days with no transactions
$fecha = (date ())-10 --> red color: mean 10 days with no transactions
2) I want two colors too in the html table. Red 0r Green. For the example if $rVal['TipoMsj'] = OK --> show green color font.
If $rVal['TipoMsj'] = TO (time out) --> show red color font.
PHP Code:
<?php
include ("database.class.php");
$obrasSocialesActivas = file ('obrasSocialesActivas.txt');
$db = new database ("mssql","192.168.x.x","name_BD","user","pass");
$lineas = count($obrasSocialesActivas);
$fecha = date("Y-m-d");
$fecha5Dias = date("Y-m-d", strtotime("-5 day", strtotime($fecha)));
$mensaje .= "<center>";
$mensaje .= strftime("Day Transaction %d / %m / %Y" ,time());
$mensaje .= "</center>";
for ($i=0; $i < $lineas; $i++) {
$obraSocial = explode("|", $obrasSocialesActivas[$i]);
$cuitOS = trim ($obraSocial[0]);
$nombreOS = $obraSocial[1];
$siglaOS = trim($obraSocial[2]);
$codigoEM = trim($obraSocial[3]);
//Tx:Transaction
/* Query SQL */
$db->query (sprintf ("select top 15 IdMsj, TipoMsj, FechaTrx, HoraTrx, RazonSocial, MensajePrinter from xchangeml..ticket (nolock)
where CuitFinanciador = '%s' and FechaTrx >= '%s' order by IdMsj desc", $cuitOS, $fecha5Dias));
$rVal = $db->get_row();
$Id = $rVal['IdMsj'];
$Response = $rVal['TipoMsj'];
$DateTx = $rVal['FechaTrx'];
$HourTx = $rVal['HoraTrx'];
$mensaje .= "<div style=\"border: 1px solid blue;\">";
$mensaje .= "<strong><big>".$nombreOS." - <u>".$siglaOS." </u>(".$codigoEM.") </big></strong><br>";
$mensaje .= "<table CellPadding=\"8\">";
$mensaje .= "<tr>";
$mensaje .= "<td><strong>Id_Mensaje</strong></td>";
$mensaje .= "<td><strong>Type_0f_Messaje</strong></td>";
$mensaje .= "<td><strong><center>DaTe</strong></center></td>";
$mensaje .= "<td><strong><center>Hour</strong></center></td>";
$mensaje .= "<td><strong><center>name</center></strong></td>";
$mensaje .= "<td><strong><center>Description</center></strong></td>";
$mensaje .= "</tr>";
/* if ($DateTx-5) transaction
{
--then color font yellow
else
{
($DateTx-10) -- transaction
--then color font red
*/
while($fila = $db->get_row()){
$mensaje .= "<tr>";
$mensaje .= "<td>" .$Id ."</td>";
$mensaje .= "<td>".$Response ."</td>";
$mensaje .= "<td>".$DateTx ."</td>";
$mensaje .= "<td>".$HourTx ."</td>";
$mensaje .= "<td>".$fila['Name']."</td>";
$mensaje .= "<td>".$fila['MessajePrinter']."</td>";
$mensaje .= "</tr>";
}
$mensaje .= "</table>";
$mensaje .= "</div>";
$mensaje .= "<br>";
}
$db->disconnect();
unset ($db);