Advertisement
yuricosss

error ayuda

Sep 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 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. mysql_connect ($dbhost, $dbusername, $dbuserpass);
  9. mysql_select_db($dbname) or die("Cannot select database");
  10.  
  11. if(empty($_GET)){;
  12. $result = mysql_query("SELECT * FROM ausuario");
  13. $result_exist = mysql_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. for ($i=0; $i<mysql_num_rows($result); $i++) {
  18. $row = mysql_fetch_assoc($result);
  19. 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>';
  20. print '<td>'.$row['appacceso'].'</td><td>'.$row['webacceso'].'</td><td>'.$row['puntos'].'</td><td>'.$row['logros'].'</td></tr>';
  21. }
  22. echo '</table>';
  23. }
  24. else
  25. {
  26. echo 'No Hay Registros';
  27. }
  28. }
  29. else
  30. {
  31. if (!empty($_GET["borra"])) {
  32. $result = mysql_query("SELECT Id FROM ausuario Where Id=".$_GET["borra"]);
  33. $result_exist = mysql_num_rows($result);
  34. if ($result_exist>0){
  35. mysql_query("DELETE FROM ausuario Where Id=".$_GET["borra"]);
  36. mysql_select_db('ausuario');
  37. header("Location: xxx-admin.php");
  38. }
  39.  
  40. }
  41. }
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement