SHARE
TWEET

Untitled

a guest Sep 4th, 2018 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Displaying database contents on a html webpage
  2. <HTML>
  3.  
  4. <HEAD>
  5.  
  6. <TITLE> LOG INFORMATION FOR ALL customers </TITLE>
  7.  
  8. </HEAD>
  9.  
  10.  
  11. <BODY>
  12.  
  13. <H1> LOG INFORMATION FOR ENTIRE DATABASE </H1>
  14.  
  15. <?php
  16.  
  17.  
  18. $database="mobile_app_tracking_log";
  19.  
  20. mysql_connect(localhost);
  21. @mysql_select_db($database) or die( "Unable to select database");
  22. $query="SELECT * FROM tablename";
  23. $result=mysql_query($query);
  24.  
  25.  
  26.  
  27. mysql_close();
  28. ?>
  29.  
  30. <table border="2" cellspacing="7" cellpadding="7">
  31. <tr>
  32. <th><font face="Arial, Helvetica, sans-serif">Index</font></th>
  33. <th><font face="Arial, Helvetica, sans-serif">Identification Number</font></th>
  34. <th><font face="Arial, Helvetica, sans-serif">Date</font></th>
  35. <th><font face="Arial, Helvetica, sans-serif">Time</font></th>
  36. <th><font face="Arial, Helvetica, sans-serif">Application</font></th>
  37. <th><font face="Arial, Helvetica, sans-serif">Usage</font></th>
  38. <th><font face="Arial, Helvetica, sans-serif">Latitude</font></th>
  39. <th><font face="Arial, Helvetica, sans-serif">Longitude</font></th>
  40. <th><font face="Arial, Helvetica, sans-serif">Address</font></th>
  41. </tr>
  42.  
  43. <?php
  44. $i=0;
  45. while ($i < $num) {
  46.  
  47.  
  48. $f1=mysql_result($result,$i,"Index");
  49. $f2-name=mysql_result($result,$i,"Identification Number");
  50. $f3-name=mysql_result($result,$i,"Date");
  51. $f4-name=mysql_result($result,$i,"Time");
  52. $f5-name=mysql_result($result,$i,"Application");
  53. $f6-name=mysql_result($result,$i,"Usage");
  54. $f7-name=mysql_result($result,$i,"Latitude");
  55. $f8-name=mysql_result($result,$i,"Longitude");
  56. $f9-name=mysql_result($result,$i,"Address");
  57. ?>
  58.  
  59. <tr>
  60. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td>
  61. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td>
  62. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>
  63. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>
  64. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td>
  65. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td>
  66. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td>
  67. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f8; ?></font></td>
  68. <td><font face="Arial, Helvetica, sans-serif"><?php echo $f9; ?></font></td>
  69. </tr>
  70.  
  71.  
  72. <?php
  73.  
  74. $i++;
  75. }
  76.  
  77. ?>
  78.    
  79. echo $f2-name;
  80. echo $f3-name;
  81. // etc
  82.    
  83. <HTML>
  84. <HEAD>
  85. <TITLE> LOG INFORMATION FOR ALL customers </TITLE>
  86. </HEAD>
  87. <BODY>
  88. <H1> LOG INFORMATION FOR ENTIRE DATABASE </H1>
  89.  
  90. <?php
  91. $user = 'root';
  92. $password = '';
  93. $database="test";
  94.  
  95. mysql_connect(localhost,$user, $password);
  96. @mysql_select_db($database) or die( "Unable to select database");
  97. echo $query = "SELECT * FROM customer";
  98. $result = mysql_query($query);
  99.  
  100. mysql_close();
  101. ?>
  102.  
  103. <table border="2" cellspacing="7" cellpadding="7">
  104. <tr>
  105. <th><font face="Arial, Helvetica, sans-serif">Index</font></th>
  106. <th><font face="Arial, Helvetica, sans-serif">Customer Name</font></th>
  107. <th><font face="Arial, Helvetica, sans-serif">Sex</font></th>
  108. </tr>
  109.  
  110. <?php
  111.  
  112. while ($row = mysql_fetch_assoc($result)) {
  113.  
  114. ?>
  115.  
  116. <tr>
  117. <td><font face="Arial, Helvetica, sans-serif"><?php echo $row[id]; ?></font></td>
  118. <td><font face="Arial, Helvetica, sans-serif"><?php echo $row[customer_name]; ?></font></td>
  119. <td><font face="Arial, Helvetica, sans-serif"><?php echo $row[sex]; ?></font></td>
  120. </tr>
  121.  
  122.  
  123. <?php
  124. }
  125. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top