Problema al imprimir en Word
Publicado por Yhoiner (1 intervención) el 07/12/2016 03:39:06
Hola, alguien me puede ayudar con este reporte en WORD, se guarda perfectamente pero al abrir el documentome dice dos errores:
Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/u505858688/public_html/Taller 2/reporte_word.php on line 32
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/u505858688/public_html/Taller 2/reporte_word.php on line 33
MI codigo es:
Warning: mysqli_query() expects at least 2 parameters, 1 given in /home/u505858688/public_html/Taller 2/reporte_word.php on line 32
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/u505858688/public_html/Taller 2/reporte_word.php on line 33
MI codigo es:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment; filename=Reporte_Avicola.doc");
$conexion=mysqli_connect("mysql.hostinger.es","u505858688_datos","yhoiner17");
mysqli_select_db("u505858688_datos",$conexion);
?>
<!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>LISTA DE USUARIOS</title>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" bgcolor="skyblue"><CENTER><strong>REPORTE DE LOS ANIMALES</strong></CENTER></td>
</tr>
<tr bgcolor="Green">
<td><strong>Animal</strong></td>
<td><strong>Raza</strong></td>
<td><strong>Cantidad</strong></td>
</tr>
<?PHP
$sql=mysqli_query("select animal,raza,cantidad from registros");
while($res=mysqli_fetch_array($sql)){
$animal=$res["animal"];
$raza=$res["raza"];
$cantidad=$res["cantidad"];
?>
<tr>
<td><?php echo $animal; ?></td>
<td><?php echo $raza; ?></td>
<td><?php echo $cantidad; ?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>
Valora esta pregunta


0