Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Intranet\verinasistencias.php on line 18
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Intranet\verinasistencias.php on line 27
Código PHP:
<?php
include "marcafiniquitos.php";
include "conexion.php";
$query="SELECT centrosdecostos.centrodecosto , dotacion.supervisor, dotacion.nombre, count(registroinasistencia.idexcepcion) as faltas
FROM dotacion, centrosdecostos, registroinasistencia where centrosdecostos.id= dotacion.idcc and dotacion.status=0 and registroinasistencia.id =dotacion.id
group by dotacion.cc , dotacion.supervisor, dotacion.nombre order by dotacion.supervisor,centrosdecostos.centrodecosto,dotacion.nombre ";
$query_result= @ mysql_query($query, $conexion);
// muestra la consulta
// print ("Consulta: " .$query ."<BR><BR>\n");
//genera la tabla HTML
echo "<TABLE BORDER='1' cellspacing='0'>\n";
echo "<TR>";
//muestra los encabezados de columna
for ($col_count=0; $col_count< mysql_num_fields($query_result) ; $col_count++)
{
$nombrecampo=mysql_field_name ($query_result,$col_count);
echo "<th> $nombrecampo</th>";
}
echo"</tr>\n";// cerrar fila
while ($row =mysql_fetch_assoc($query_result)) {
echo "<tr>"; // crear fila
foreach ($row as $key =>$value) {
echo "<td>$value ";
}
echo " </td></tr>\n"; // cerrar fila
}
echo "</table>\n"; //cerrar tabla
include "cerrar_conexion.php";
?>
De antemano gracias