Advertisement
Strafe777

php broke

May 1st, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML. 1.0 Strict//EN" "http://w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title></title>
  5. <meta http-equiv="content-type"
  6. <content="text/html; charset=iso-8859-1" />
  7. <link rel="stylesheet" type="text/css" href="bootstrap-3.3.6-dist/css/bootstrap.min.css">
  8. <link rel="stylesheet" type="text/css" href="bootstrap-social-gh-pages/assets/css/font-awesome.css">
  9. <link rel="stylesheet" type="text/css" href="MyCSS.css">
  10. </head>
  11. <body>
  12. <div class="container-fluid">
  13. <div class="row-fluid">
  14. <div class="col-sm-12">
  15. <div class="jumbotron">
  16. <h1 align="center">Products</h1>
  17. <p align="center">We the best products around Christiansburg, Va!</p>
  18. <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
  19. </div>
  20. </div>
  21.  
  22. </div>
  23. </div>
  24.  
  25. <div class="container-fluid">
  26. <div class="row-fluid">
  27. <div class="col-sm-12">
  28. <ul class="nav nav-tabs">
  29. <li class="active"><a href="index.php">Home</a></li>
  30. <li><a href="productsPage.php">Products</a></li>
  31. <li><a href="#">Cart</a></li>
  32. </ul>
  33.  
  34. </nav>
  35. </div>
  36. </div>
  37. </div>
  38. <!--body content-->
  39.  
  40. <div class="col-sm-12">
  41. <!--create the table in php-->
  42. <?php
  43. include('connectDB.php');
  44. $TableName = "products";
  45. $Products = array();
  46. $sql =" SELECT ProductName, Cost, ProductDescription FROM $TableName";
  47. $result = $conn->query($sql);
  48. if ($result->num_rows > 0)
  49. {
  50. while($Row = $result->fetch_assoc())
  51. $Products[] = $Row;
  52.  
  53. }
  54.  
  55.  
  56. echo "<table border='1' width='100%'>\n";
  57. echo "<tr>\n";
  58. echo "<th style='background-color:grey'>Product Image</th>\n";
  59. echo "<th style='background-color:grey'>Product Name</th>\n";
  60. echo "<th style='background-color:grey'>ProductID</th>\n";
  61. echo "<th style='background-color:grey'>Product Description</th>\n";
  62. echo "<th style='background-color:grey'>Quantity On_Hand</th>\n";
  63. echo "<tr>\n";
  64.  
  65. foreach ($Products as $Products) {
  66. if(!in_array($Products['products'])) {
  67. echo "<tr>\n";
  68. echo "<td>" .htmlentities($Opportunity['ProductName']). "</td>\n";
  69. echo "<td>" .htmlentities($Opportunity['ProductID']). "</td>\n";
  70. echo "<td>" .htmlentities($Opportunity['Cost']). "</td>\n";
  71. echo "<td>" .htmlentities($Opportunity['ProductDescription']). "</td>\n";
  72. echo "<td>" .htmlentities($Opportunity['QuantityOn_Hand']). "</td>\n";
  73.  
  74. }
  75. echo "</table>";
  76. }
  77.  
  78. $conn->close();
  79.  
  80.  
  81.  
  82. ?>
  83. </div>
  84. <!--end body content-->
  85. </div>
  86. </div>
  87. <script src="jquery-1.10.2.min.js"></script>
  88. <script src="bootstrap-3.3.6-dist/js/bootstrap.min.js"></script>
  89. </body>
  90. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement