Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.55 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3.         <head>
  4.                 <title> Wheres the fucking title!!</title>
  5.         </head>
  6.         <body>
  7.                 <h4>DATA TABLE:</h4>
  8.                 <table border=1 cellspacing=0 cellpadding=5 style="border: 1px solid #ccc;" >
  9.                         <tr>
  10.                                 <th>Name</th>
  11.                                 <th>Age</th>
  12.                                 <th>Eye Colour</th>
  13.                                 <th>Height</th>
  14.                                 <th>Weight</th>
  15.                         </tr>
  16.                         <?php
  17.                         $host = "localhost";
  18.                         $username = "phpdood";
  19.                         $password = "PopenHsesameP";
  20.                         $database = "kj_database2";
  21.                         mysql_connect($host,$username,$password);
  22.                         @mysql_select_db($database) or die("Unable to select database: ". mysql_error());
  23.                         $query  = "SELECT * FROM kj_datatable2";
  24.                         $result = mysql_query($query);
  25.                         $num = mysql_numrows($result);
  26.                         $i=0;
  27.                         while ($i < $num) {
  28.                                 $name=mysql_result($result,$i,"name");
  29.                                 $age=mysql_result($result,$i,"age");
  30.                                 $eye_colour=mysql_result($result,$i,"eye_colour");
  31.                                 $height=mysql_result($result,$i,"height");
  32.                                 $weight=mysql_result($result,$i,"weight");
  33.                                 ?>
  34.                         <tr>
  35.                                 <td><?php print "$name"; ?></td>
  36.                                 <td><?php print "$age"; ?></td>
  37.                                 <td><?php print "$eye_colour"; ?></td>
  38.                                 <td><?php print "$height"; ?></td>
  39.                                 <td><?php print "$weight"; ?></td>
  40.                         </tr>
  41.                                 <?php
  42.                                 $i++;
  43.                         }?>
  44.                 </table>
  45.                 <form method="post" action="insert.php" name="insert_form" >
  46.                         <table width="400px" >
  47.                                 <tr><td>Name:</td><td><input type="text" name="name"> </td></tr>
  48.                                 <tr><td>Age:</td><td><input type="text" name="age"></td></tr>
  49.                                 <tr><td>Weight:</td><td><input type="text" name="weight"></td></tr>
  50.                                 <tr><td>Eye Color:</td><td>
  51.                                                 <select  name="eye_colour">
  52.                                                         <option value="blue" >Blue</option>
  53.                                                         <option value="brown" >Green</option>
  54.                                                         <option value="hazel" >Hazel</option>
  55.                                                         <option value="green" >Green</option>
  56.                                                         <option value="brown" >Brown</option>
  57.                                                 </select>
  58.                                 </td></tr>
  59.                                 <tr><td>Height:</td><td><input type="text" name="height"/></td></tr>
  60.                                 <tr><td></td><td><input type="submit" /></td></tr>
  61.                         </table>
  62.                 </form>
  63.         </body>
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement