Advertisement
Guest User

Untitled

a guest
May 30th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5.         <link rel="stylesheet" type="text/css" href="stylesheet.css.css" />
  6.         <title>Internet Jokes, now laugh.</title>
  7.     </head>
  8.     <body>
  9.         <?php
  10.         $host = "localhost";
  11.         $user = "root";
  12.         $pass = "";
  13.         $db = "ijdb";
  14.  
  15.         $connection = mysql_connect($server, $user, $pass);
  16.  
  17.         mysql_select_db($db) or die ("Unable to select database!");
  18.  
  19.         $query = "SELECT * FROM joke";
  20.         $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
  21.  
  22.         if (mysql_num_rows($result) > 0) {
  23.         while($row = mysql_fetch_row($result)) {
  24.  
  25.         echo '<div id = "joketable">';
  26.         echo "<table border='1'>";
  27.         echo "<td width = 20>".$row[0]."</td>";
  28.         echo "<td width = 100>".$row[1]."</td>";
  29.         echo "<td width = 100>".$row[2]."</td>";
  30.         echo '</div>';
  31.     }
  32. }
  33. mysql_free_result($result);
  34. mysql_close($connection);
  35.  
  36.  
  37.         ?>
  38.  
  39.  
  40. <link rel="stylesheet" type="text/css" href="stylesheet.css" />
  41.  
  42.  
  43.  
  44.  
  45.  
  46.     </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement