es posible llamar a una vista mysql desde php directamente, es que la consulta contenida en la vista mysql es un poco extensa
porque he probado a hacer esto
Código PHP:
Ver original<!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" />
<title>Untitled Document</title>
</head>
<body>
<table border="1" cellspacing=1 cellpadding=2 style="font-size: 8pt"><tr>
<td><font face="verdana"><b>Lente</b></font></td>
<td><font face="verdana"><b>descripción</b></font></td>
<td><font face="verdana"><b>N. Abbe</b></font></td>
<td><font face="verdana"><b>densidad</b></font></td>
<td><font face="verdana"><b>N. Abbe</b></font></td>
<td><font face="verdana"><b>densidad</b></font></td>
</tr>
<?php
or
die ("Error al conectar a la base de datos."); or
die ("Error al conectar a la base de datos.");
$query = "select rx.d_rx, rx.id_cil,rx.id_esf,esfera.esfera,cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf = esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilndro.id_cil)))
where
((cilindro.cilindro between -(1.00) and 0.00)
and (esfera.esfera between -(5.00) and 6.00))
union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro between -(2.00) and -(1.25))
and (esfera.esfera between -(4.00) and 4.00))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(1.25))
and (esfera.esfera between 4.25 and 5.00))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(1.50))
and (esfera.esfera between 4.25 and 4.75))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(1.75))
and (esfera.esfera = 4.25))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(1.25))
and (esfera.esfera between -(4.75) and -(4.25)))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(1.50))
and (esfera.esfera between -(4.50) and -(4.25)))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = 0.00)
and (esfera.esfera between -(6.00) and -(5.25)))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(0.25))
and (esfera.esfera between -(5.75) and -(5.25)))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(0.50))
and (esfera.esfera between -(5.50) and -(5.25)))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(0.75))
and (esfera.esfera between -(5.25) and -(5.25)))) union (select
rx.id_rx,
rx.id_cil,
rx.id_esf,
esfera.esfera,
cilindro.cilindro
from
((rx
join esfera ON ((rx.id_esf =esfera.id_esf)))
join cilindro ON ((rx.id_cil = cilindro.id_cil)))
where
((cilindro.cilindro = -(1.75))
and (esfera.esfera = -(4.25)))) order by esfera.esfera desc , cilindro.cilindro desc"
;
$numero = 0;
{
echo "<tr><td width=\"25%\"><font face=\"verdana\">" .
$row["rx.id_rx"] . "</font></td>";
echo "<td width=\"25%\"><font face=\"verdana\">" .
$row["rx.id_cil"] . "</font></td>";
echo "<td width=\"25%\"><font face=\"verdana\">" .
$row["rx.id_esf"] . "</font></td>";
echo "<td width=\"25%\"><font face=\"verdana\">" .
$row["esfera.esfera"]. "</font></td></tr>";
echo "<tr><td width=\"25%\"><font face=\"verdana\">" .
$row["cilindro.cilindro"] . "</font></td>";
$numero++;
}
echo "<tr><td colspan=\"15\"><font face=\"verdana\"><b>Número: " . $numero .
"</b></font></td></tr>";
?>
</table>
</body>
</html>
y obtengouna tabla vacia con los enabezados