Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <title>jQuery UI Datepicker and Filterer</title>
  6.  
  7.  
  8. <!-- jQuery -->
  9. <script src="jquery/jquery-1.11.1.js"> </script>
  10.  
  11. <!-- jPList Core -->
  12. <link href="jquery-ui-bundle/css/jplist-core.min.css" rel="stylesheet" type="text/css" />
  13. <script src="jquery-ui-bundle/js/jplist-core.min.js"></script>
  14.  
  15. <!-- jQuery UI Bundle -->
  16. <link href="jquery-ui-bundle/css/jplist-jquery-ui-bundle.min.css" rel="stylesheet" type="text/css" />
  17. <script src="jquery-ui-bundle/js/jplist.jquery-ui-bundle.min.js"></script>
  18.  
  19. <!-- Stylesheet -->
  20. <link type="text/Style" href="filter.css" rel="stylesheet"/>
  21. </head>
  22.  
  23. <body>
  24. <div id="header">
  25. <div class="logo">
  26. <img src="ss_logo_motto_gety_white_01.png">
  27. </div>
  28. </div>
  29.  
  30. <div id="wrapper">
  31.  
  32.  
  33.  
  34. <div id="nav">
  35.  
  36. </div>
  37. <div id="content">
  38. <div id="inputfield">
  39. <label for="filter">Filter</label>
  40. <input id="filter" type="search" placeholder="Search" autofocus name="Search">
  41. <label for="dateFr">From</label>
  42. <input id="dateFr" type="text" placeholder="DD/MM/YYYY" name="From">
  43. <label for="dateTo">To</label>
  44. <input id="dateTo" type="text" placeholder="DD/MM/YYYY" name="To">
  45. </div>
  46. <?php
  47.  
  48. // Connect to database
  49. mysql_connect('localhost', 'root', 'root');
  50. mysql_select_db('CSV_DB');
  51.  
  52. echo"<table>
  53. <thead>
  54. <tr>
  55. <th>#</th>
  56. <th>Date of Order</th>
  57. <th>Order Number</th>
  58. <th>Reseller</th>
  59. <th>Distributor</th>
  60. <th>Customer</th>
  61. <th>Country</th>
  62. <th>Product</th>
  63. <th>Quantity</th>
  64. <th>Price of Unit</th>
  65. <th>Total Price</th>
  66. <th>Currency</th>
  67. <th>Total in SEK</th>
  68. </tr>
  69. </thead>";
  70.  
  71. $sql = mysql_query("SELECT
  72. ID,
  73. ORDER_DATE,
  74. ORDER_NUMBER,
  75. RESELLER,
  76. DISTRIBUTOR,
  77. CUSTOMER,
  78. COUNTRY,
  79. PRODUCT,
  80. QUANTITY,
  81. UNIT_PRICE,
  82. TOTAL_PRICE,
  83. CURRENCY,
  84. TOTAL_SEK
  85. FROM `TBL_NAME` ORDER BY `ID` ");
  86.  
  87. while($rest = mysql_fetch_assoc($sql))
  88. {
  89. if($i++ % 2)
  90. {
  91. echo "<tr class='even'>";
  92. echo "<td>$rest[ID]</td>";
  93. echo "<td>$rest[ORDER_DATE]</td>";
  94. echo "<td>$rest[ORDER_NUMBER]</td>";
  95. echo "<td>$rest[RESELLER]</td>";
  96. echo "<td>$rest[DISTRIBUTOR]</td>";
  97. echo "<td>$rest[CUSTOMER]</td>";
  98. echo "<td>$rest[COUNTRY]</td>";
  99. echo "<td>$rest[PRODUCT]</td>";
  100. echo "<td>$rest[QUANTITY]</td>";
  101. echo "<td>$rest[UNIT_PRICE]</td>";
  102. echo "<td>$rest[TOTAL_PRICE]</td>";
  103. echo "<td>$rest[CURRENCY]</td>";
  104. echo "<td>$rest[TOTAL_SEK]</td> </tr>";
  105. } else {
  106.  
  107. echo "<tr class='odd'>";
  108. echo "<td>$rest[ID]</td>";
  109. echo "<td>$rest[ORDER_DATE]</td>";
  110. echo "<td>$rest[ORDER_NUMBER]</td>";
  111. echo "<td>$rest[RESELLER]</td>";
  112. echo "<td>$rest[DISTRIBUTOR]</td>";
  113. echo "<td>$rest[CUSTOMER]</td>";
  114. echo "<td>$rest[COUNTRY]</td>";
  115. echo "<td>$rest[PRODUCT]</td>";
  116. echo "<td>$rest[QUANTITY]</td>";
  117. echo "<td>$rest[UNIT_PRICE]</td>";
  118. echo "<td>$rest[TOTAL_PRICE]</td>";
  119. echo "<td>$rest[CURRENCY]</td>";
  120. echo "<td>$rest[TOTAL_SEK]</td></tr>";
  121. }
  122. }
  123.  
  124. echo "</table>";
  125.  
  126. mysql_close();
  127. ?>
  128. </div>
  129.  
  130. </div>
  131.  
  132. </body>
  133.  
  134. <script>
  135.  
  136. // Search Filter
  137. $(document).ready(function(){
  138. $("#filter").keyup(function(){
  139.  
  140. // Retrieve the input field text
  141. var filter = $(this).val();
  142.  
  143. // Loop through the comment list
  144. $("tbody tr").each(function(){
  145.  
  146. // If the list item does not contain the text phrase fade it out with a millisecond delay
  147. if ($(this).text().search(new RegExp(filter, "i")) < 0) {
  148. $(this).fadeOut(1);
  149.  
  150. // Show the list item if the phrase matches
  151. } else {
  152. $(this).show();
  153. }
  154.  
  155. });
  156. });
  157. });
  158.  
  159.  
  160.  
  161. //Used to highligt hovered table rows
  162. $('tbody tr').hover(function(){
  163. $(this).find('td').addClass('hovered');
  164. }, function(){
  165. $(this).find('td').removeClass('hovered');
  166. });
  167.  
  168. </script>
  169.  
  170.  
  171. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement