Advertisement
Guest User

Untitled

a guest
May 25th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Práctica</title>
  5. </head>
  6. <body>
  7.  
  8. <?php
  9.  
  10. $servername = "localhost";
  11. $username = "root";
  12. $password = "root";
  13.  
  14. // Create connection
  15. $conn = new mysqli($servername, $username, $password);
  16.  
  17. // Check connection
  18. if ($conn->connect_error) {
  19.     die("Connection failed: " . $conn->connect_error);
  20. }
  21.  
  22. ?>
  23.  
  24. <h1>Marcas</h1>
  25.  
  26. <table border="1">
  27.     <thead>
  28.         <tr><th>Id<th>Nombre
  29.     </thead>
  30.     <tbody>
  31.         <? $result = $conn->query("select * from marcas");
  32.           if($result->num_rows>0)
  33.             while($row=$result->fetch_assoc()){
  34.                 ?>
  35.                 <tr><td><?echo $row["id"];?> <td><? echo $row["nombre"]; ?>
  36.             <?}?>
  37.        
  38.     </tbody>
  39. </table>
  40.  
  41. </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement