Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $username = "phpdood";
- $password = "PopenHsesameP";
- $database = "kj_database2";
- mysql_connect($host,$username,$password);
- @mysql_select_db($database) or die("Unable to select database: ". mysql_error());
- $query = "SELECT * FROM kj_datatable2";
- $result = mysql_query($query);
- $num = mysql_numrows($result);
- $i=0;
- ?>
- <html>
- <body>
- <h4>DATA TABLE:</h4>
- <table border="5">
- <tr>
- <th>Name</th> <th>Age</th> <th>Eye Colour</th> <th>Height</th> <th>Weight</th>
- </tr>
- <tr>
- <?php
- while ($i < $num) {
- $name=mysql_result($result,$i,"name");
- $age=mysql_result($result,$i,"age");
- $eyecolour=mysql_result($result,$i,"eye_colour");
- $height=mysql_result($result,$i,"height");
- $weight=mysql_result($result,$i,"weight");
- ?>
- <td><?php print "$name"; ?><td>
- <td><?php print "$age"; ?></td>
- <td><?php print "$eyecolour"; ?></td>
- <td><?php print "$height"; ?></td>
- <td><?php print "$weight"; ?></td>
- <?php
- $i++;
- }
- ?>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement