Variable desconocida no se porque
Publicado por rami (74 intervenciones) el 11/11/2013 16:03:18
Hola amigos
La variable $aItems es desconocida porque?
Este el archivo con html.
Y aca esta empleado.php
Dice:
Notice: Undefined variable: aItems in C:\xampp\htdocs\sge\empleado\lista.php on line 47
Muchas gracias
La variable $aItems es desconocida porque?
Este el archivo con html.
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
// Incluyo la clase de base de datos
require_once $_SERVER['DOCUMENT_ROOT'] . '/sge/includes/php/BaseDeDatos.php';
// Incluyo la clase de empleado
require_once $_SERVER['DOCUMENT_ROOT'] . '/sge/empleado/includes/empleado.php';
// Creo el objeto para luego obtener todos los empleados
$oEmpleado = new empleado();
// Obtengo el array con todos los objetos de empleado
$aItems = $oEmpleado->getAll();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SGE | Lista de Empleados</title>
<link rel="stylesheet" type="text/css" href="/sge/includes/css/style.css" />
</head>
<body>
<div class="wrapper">
<div class="background"></div>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/sge/includes/php/header.php';?>
<div class="main">
<div class="buttons">
<button type="button" onclick="document.location = '/sge/empleado/agregar.php'">Agregar Empleado</button>
</div>
<table>
<tr>
<th>ID</th>
<th>APELLIDO</th>
<th>NOMBRE</th>
<th>LEGAJO</th>
<th colspan="2"> </th>
</tr>
<?php if ( count( $aItems ) == 0 ) { ?>
<tr>
<td colspan="6">No se han encontrado resultados</td>
</tr>
<?php } else { foreach ( $aItems as $item ) { ?>
<tr>
<td><?php echo $item->getIdEmpleado(); ?></td>
<td><?php echo $item->getApellido(); ?></td>
<td><?php echo $item->getNombre(); ?></td>
<td><?php echo $item->getLegajo(); ?></td>
<td><a class="icon ver" title="Ver/Editar" href="/sge/empleado/empleado.php?id=<?php echo $item->getIdEmpleado(); ?>"></a></td>
<td><a class="icon eliminar" title="Eliminar" href="/sge/empleado/confirmar_eliminar.php?id=<?php echo $item->getIdEmpleado(); ?>"></a></td>
</tr>
<?php } } ?>
</table>
<div class="buttons">
<button type="button" onclick="document.location = '/sge/aplicaciones'">Aplicaciones</button>
</div>
</div>
</div>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/sge/includes/php/footer.php';?>
</body>
</html>
Y aca esta empleado.php
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
52
<?php
class empleado{
private $_idEmpleado;
private $_apellido;
private $_legajo;
private $_nombre;
public function setIdEmpleado($idEmpleado){
$this->_idEmpleado=$idEmpleado;
}
public function setApellido($apellido){
$this->_apellido=$apellido;
}
public function setLegajo($legajo){
$this->_legajo=$legajo;
}
public function setNombre($nombre){
$this->_nombre=$nombre;
}
public function getIdEmpleado(){
return $this->_idEmpleado;
}
public function getapellido(){
return $this->_apellido;
}
public function insertar(){
$SQL="insert into Empleado values";
$SQL.="'','$this->_apellido',$this->_legajo,'$this->_nombre'";
$resultado=mysql_query($SQL) or die (mysql_errno());
}
public function get_empleado_porid($_legajo){
$SQL="select idempleado from empleado";
$SQL.="where legajo=$this->_legajo";
$empleado.arrayejecutar($SQL);
return $arrayempleado['idempleado'];
}
public function modificar(){
$SQL="update Empleado";
$SQL.="SET";
}
public function getAll(){
$SQL="select * from empleado";
$resultado=mysql_query($SQL,$conexion) or die (mysql_errno());
$objeto=mysql_fetch_array($resultado);
return $objeto;
}
}
$oEmpleado=new empleado();
?>
Notice: Undefined variable: aItems in C:\xampp\htdocs\sge\empleado\lista.php on line 47
Muchas gracias
Valora esta pregunta


0