Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="table-responsive">
- <form action="checkruta.php" method="post" >
- <table class="table table-striped table-hover">
- <tr>
- <th>Folio </th>
- <th>Nombre</th>
- <th>Fecha solicitud</th>
- <th>Solicitud</th>
- <th>Estado</th>
- <th>Fecha Reporte</th>
- <th>Seleccionar Ruta</th>
- </tr>
- <?php
- if($filter){
- $sql = mysqli_query($con, "SELECT * FROM contribuyente WHERE estado='$filter' ORDER BY id ASC");
- }else{
- $sql = mysqli_query($con, "SELECT * FROM contribuyente ORDER BY id ASC");
- }
- if(mysqli_num_rows($sql) == 0){
- echo '<tr><td colspan="8">No hay datos.</td></tr>';
- }else{
- $no = 1;
- while($row = mysqli_fetch_assoc($sql)){
- echo '
- <tr>
- <td>'.$row['id'].'</td>
- <td><a href="profile.php?nik='.$row['nombre'].'"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> '.$row['nombre'].'</a></td>
- <td>'.$row['fecha'].'</td>
- <td>'.$row['mensaje'].'</td>
- <td>'.$row['estado'].'</td>
- <td>'.$row['fecha_rec'].'</td>
- <td> <input type="checkbox" name="id[]" value=<?php echo $row["id"]; ?></td>
- <td>';
- if($row['estado'] == 'Resuelto'){
- echo '<span class="label label-success">Resuelto</span>';
- }
- else if ($row['estado'] == 'Pendiente' ){
- echo '<span class="label label-info">Pendiente</span>';
- }
- else if ($row['estado'] == 'Rechazado' ){
- echo '<span class="label label-warning">Rechazado</span>';
- }
- echo '
- </td>
- </tr>
- ';
- $no++;
- }
- }
- ?>
- </table>
- <input type="submit" name="autorizados" value="Autorizar seleccionados" />
- </div>
- </div>
- </div>
- <?php
- if (isset($_POST['autorizados'])) {
- //Conexión Mysql.
- $db_host="localhost";
- $db_user="root";
- $db_password= "";
- $db_name="bdpagina";
- $db_connection = mysqli_connect($db_host, $db_user, $db_password, $db_name);
- $id = $_POST['id'];
- $count = count($id);
- $status = 'AUTORIZADA';
- for ($i=0; $i < $count; $i++) {
- mysqli_query($db_connection,"UPDATE contribuyente SET ruta='$status'
- WHERE id='$id[$i]' LIMIT 1");
- }
- mysqli_close($db_connection);
- echo "Se actualizo correctamente";
- }
- ?>
- $result=mysqli_query($db_connection,"UPDATE contribuyente SET ruta='$status'
- WHERE id='$id[$i]' LIMIT 1");
- if($result){
- $message = "Consulta realizada.";
- } else {
- $message = "Se ha producido un error.";
- }
- mysqli_close($db_connection);
- echo $message;
- if ($db_connection->connect_error) {
- die("Error de conexión: " . $db_connection->connect_error);
- }
Add Comment
Please, Sign In to add comment