Código PHP:
<?PHP
include_once "db_connCliente.php";
$id_paquete = 120;
$fecha = "2011-11-%";
$sql = "SELECT date(o.fe_orden) FROM tablaeo o group by date(o.fe_orden)";
$resql = mysql_query($sql);
if (!$resql)
{
echo 'Could not run query($resql): ' . mysql_error();
exit;
}
$rosql = mysql_fetch_row($resql);
if (!$rosql)
{
echo 'Could not run query($rosql): ' . mysql_error();
exit;
}
$sql1 = "SELECT date(o.fe_orden), COUNT(*) AS 'No Confirmadas' FROM tablaeo o WHERE o.id_paquete=111 AND o.status_confirmada=0 group by date(o.fe_orden)";
$sql2 = "SELECT date(o.fe_orden), COUNT(*) AS 'Confirmadas' FROM tablaeo o WHERE o.id_paquete=111 AND o.status_confirmada<>0 group by date(o.fe_orden)";
$Q_OrdenTDC = "SELECT date(o.fe_orden), COUNT(*) AS 'Orden TDC' FROM tablaeo o WHERE o.id_paquete=".$id_paquete." AND o.status_confirmada in(3,4) group by date(o.fe_orden)";
$Q_PagoTDC = "SELECT date(o.fe_orden), COUNT(*) AS 'Pago TDC' FROM tablaeo o, edm.cliente_tarjeta t WHERE o.id_paquete=t.id_paquete AND t.id_cliente=o.id_cliente AND o.id_paquete=".$id_paquete." AND o.status_confirmada in(3,4) AND t.autorizacion<>0 group by date(o.fe_orden)";
$Q_OrdenBNK = "SELECT date(o.fe_orden), COUNT(*) AS 'Orden BNK' FROM tablaeo o WHERE o.id_paquete=".$id_paquete." AND o.status_confirmada in(6,12) group by date(o.fe_orden)";
$Q_PagoBNK = "SELECT date(o.fe_orden), COUNT(*) AS 'Pago BNK' FROM tablaeo o WHERE o.id_paquete=".$id_paquete." AND o.status_confirmada in(6,12) AND o.payment<>0 group by date(o.fe_orden)";
$ressql1 =mysql_query($sql1);
if (!$ressql1)
{
echo 'Could not run query($ressql1): ' . mysql_error();
exit;
}
$ressql2 =mysql_query($sql2);
if (!$ressql2)
{
echo 'Could not run query($ressql2): ' . mysql_error();
exit;
}
$resQ_OrdenBNK = mysql_query($Q_OrdenBNK);
if (!$resQ_OrdenBNK)
{
echo 'Could not run query($resQ_OrdenBNK): ' . mysql_error();
exit;
}
$resQ_PagoBNK = mysql_query($Q_PagoBNK);
if (!$resQ_PagoBNK)
{
echo 'Could not run query($resQ_PagoBNK): ' . mysql_error();
exit;
}
$resQ_OrdenTDC = mysql_query($Q_OrdenTDC);
if (!$resQ_OrdenTDC)
{
echo 'Could not run query($resQ_OrdenTDC): ' . mysql_error();
exit;
}
$resQ_PagoTDC = mysql_query($Q_PagoTDC);
if (!$resQ_PagoTDC)
{
echo 'Could not run query($resQ_PagoTDC): ' . mysql_error();
exit;
}
while($rowQ_OrdenBNK = mysql_query($resQ_OrdenBNK))//Sale Resource #7
{
print_r($rowQ_OrdenBNK);
if (!$rowQ_OrdenBNK)
{
echo 'Could not run query($rowQ_OrdenBNK): ' . mysql_error();
exit;
}
}
if (!$rowQ_OrdenBNK)
{
echo 'Could not run query($rowQ_OrdenBNK): ' . mysql_error();
exit;
}
$rowQ_PagoBNK = mysql_query($resQ_PagoBNK);
if (!$rowQ_PagoBNK)
{
echo 'Could not run query($rowQ_PagoBNK): ' . mysql_error();
exit;
}
$rowQ_OrdenTDC = mysql_query($resQ_OrdenTDC);
if (!$rowQ_OrdenTDC)
{
echo 'Could not run query($rowQ_OrdenTDC): ' . mysql_error();
exit;
}
$rowQ_PagoTDC = mysql_query($resQ_PagoTDC);
if (!$rowQ_PagoTDC)
{
echo 'Could not run query($rowQ_PagoTDC): ' . mysql_error();
exit;
}//*/
?>
<!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" />
</head>
<?php
//No se que efecto tenga el Resource #7 en estos whiles
while($rowQ_OrdenTDC = mysql_fetch_row($resQ_OrdenTDC))
{
while($rowQ_OrdenBNK = mysql_fetch_row($resQ_OrdenBNK))
{
while($rowQ_PagoTDC = mysql_fetch_row($resQ_PagoTDC))
{
while($rowQ_PagoBNK = mysql_fetch_row($resQ_PagoBNK))
{
/*echo '$rowQ_OrdenBNK'."<br>";
var_dump($rowQ_OrdenBNK);
echo "<br/><br/>";
echo '$rowQ_PagoTDC'."<br>";
var_dump($rowQ_PagoTDC);
echo "<br/><br/>";
echo '$rowQ_PagoBNK'."<br>";
var_dump($rowQ_PagoBNK);
echo "<br/><br/>"; */
print_r($rowQ_OrdenTDC);
echo '$rowQ_OrdenTDC'."<br/><br/>";
print_r($rowQ_OrdenBNK);
echo '$rowQ_OrdenBNK'."<br/><br/>";
print_r($rowQ_PagoTDC);
echo '$rowQ_PagoTDC'."<br/><br/>";
print_r($rowQ_PagoBNK);
echo '$rowQ_PagoBNK'."<br/><br/>";
}
}
}
}
?>
<body>
</body>
</html>