actualizar en PHP
Publicado por jhon (1 intervención) el 09/04/2018 03:27:49
Hola buenas noches, soy nuevo programando, y no eh podido hallar el error en mi codigo. necesito actualizar datos con php pero no se cual es el error, podrian ayudarme?
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Empleados</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="estilos1.css">
</head>
<body class="fondo">
<div class="container-fluid">
<header>
<div class="col-md-12">
</div>
</header>
<section >
<h2 align="center">Listado de empleados</h2>
<table class="table table-bordered table-responsive table-condensed table-striped" border="1" width="500" align="center ">
<tr bgcolor="skyblue">
<th size="20" colspan="11 " class="info"><center>Beneficiarios</center><br></th>
</tr><br>
<tr bgcolor="skyblue">
<th>#identificacion</th><th>Tipo documeto</th><th>Nombres</th>
<th>Apellidos</th><th>Fecha Nacimiento</th>
<th>Fecha ingreso</th> <th>Rh</th> <th>Telefono</th> <th>Email</th>
<th>Eps</th> <th>Ciudad</th>
</tr>
<?php
$cnx=new PDO("mysql:host=localhost;dbname=phoenix","root","");
$res = $cnx->query("select * from beneficiarios");
$num_resul= $res->rowCount();
$registros=3;
if(isset($_REQUEST['num'])){
$pagina=$_REQUEST['num'];
$inicio=(($pagina)-1)*$registros;
}else{
$inicio=0;
$pagina=1;
}
$res = $cnx->query("select * from beneficiarios limit $inicio,$registros");
$paginas= ceil($num_resul/$registros);
foreach ($res as $row)
{
?>
<tr>
<td style="background: #e0e0e0;"><?php echo $row[0]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[1]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[2]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[3]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[4]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[5]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[6]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[7]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[8]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[9]; ?></td>
<td style="background: #e0e0e0;"><?php echo $row[10]; ?></td>
<td><a href="editarbenef.php?cod=<?php echo $row[0]; ?>">Editar</a>
|| <a href="eliminarbenefvalida.php?accion=eliminar&cod=<?php echo $row[0]; ?>">Eliminar</td>
<td > <a href="nuevobenef.php?cod=<?php echo $row[0]; ?>">Nuevo</a>
</tr>
<?php
}
?>
</table>
<center>
<?php
if($pagina>1)
echo "<a href=tablabenef.php?num=".($pagina-1).">Anterior</a> ";
for($i=1;$i<=$paginas;$i++){
if($i==$pagina)
echo $i." ";
else
echo "<a href=tablabenef.php?num=$i>".$i."</a> ";
}
if($pagina<$paginas)
echo "<a href=tablabenef.php?num=".($pagina+1).">Siguiente</a> ";
?>
</center>
</font>
</section>
<h3 align="center">
<a href="proyecto.php">
Cerrar Sesion
</a>
</h3>
</div>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Valora esta pregunta
0