Advertisement
Guest User

Yruko2

a guest
Sep 5th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php
  2. $dbhost='localhost';
  3. $dbusername='root';
  4. $dbuserpass='ascent';
  5. $dbname='listado';
  6.  
  7. // Conexion a la base de datos
  8. $con = mysqli_connect ($dbhost, $dbusername, $dbuserpass);
  9. mysqli_select_db($con, $dbname) or die("Cannot select database");
  10.  
  11. if(empty($_GET)){
  12.     $result = mysqli_query($con, "SELECT * FROM ausuario");
  13.     $result_exist = mysqli_num_rows($result);
  14.     if ($result_exist>0)
  15.     {
  16.         echo '<table border=1><tr align=center valign=middle><td>Borrar</td><td>Id</td><td>Equipo</td><td>Appacceso</td><td>Webacceso</td><td>Puntos</td><td>Logros</td></tr>';
  17.         while ($row = mysqli_fetch_assoc($result)) {
  18.             print '<tr align= center valign= middle><td><a href="xxx-admin.php?borra='.$row['id'].'">ok</a></td><td><b>'.$row['id'].'</td><td>'.$row['equipo'].'</b></td>';
  19.             print '<td>'.$row['appacceso'].'</td><td>'.$row['webacceso'].'</td><td>'.$row['puntos'].'</td><td>'.$row['logros'].'</td></tr>';
  20.         }
  21.         echo '</table>';
  22.     }
  23.     else
  24.     {
  25.         echo 'No Hay Registros';
  26.     }
  27. }
  28. else
  29. {
  30.     if (!empty($_GET["borra"])) {
  31.         $result = mysqli_query($con, "SELECT Id FROM ausuario Where Id=".$_GET["borra"]);
  32.         $result_exist = mysqli_num_rows($result);
  33.         if ($result_exist>0){
  34.             mysqli_query($con, "DELETE FROM ausuario Where Id=".$_GET["borra"]);
  35.             mysqli_select_db($con, 'ausuario');
  36.             header("Location: xxx-admin.php");
  37.         }
  38.     }
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement