Advertisement
Guest User

Error 1049 - Unknown Database

a guest
Mar 1st, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <!doctype HTML>
  2. <head>
  3.  
  4.   <title>Soccer.db | The Ultimate Database for Soccer Stats, Info, & News</title>
  5.  
  6.   <link rel="stylesheet" href="football.css" />
  7.  
  8. </head>
  9. <body>
  10.  
  11.   <?php
  12.  
  13.   $host = "localhost";
  14.   $username = "root";
  15.   $password = "root";
  16.   $db = "soccer_db";
  17.  
  18.   $db_con = new mysqli($host, $username, $password, $db);
  19.  
  20.   if ($db_con->connect_errno) {
  21.     echo "Failed to connecto to MySQL: (" . $db_con->connect_errno . ") " . $db_con->connect_error;
  22.   }
  23.   echo $db_con->host_info . "\n";
  24.  
  25.   $result = mysqli_query($db_con, "SELECT * FROM players");
  26.  
  27.   $db_con->close();
  28.  
  29.   ?>
  30. <div class="top-nav-wrapper">
  31.   <div class="top-nav-content">
  32.     <span>Soccer.db</span>
  33.   </div>
  34. </div>
  35. <div class="long-ad-wrapper">
  36.   <div class="long-ad-content">
  37.  
  38.   </div>
  39. </div>
  40. <?php
  41.  
  42.  echo "<table>";
  43.  
  44.  while($row = mysqli_fetch_array($result)){
  45.    echo "<tr><td>" . $row['firstname'] . "</td><td>" . $row['lastname'] . "</td><td>" . $row['age'] . "</td></tr>";
  46.  
  47.  echo "</table>";
  48.  }
  49. ?>
  50. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement