Guest User

Untitled

a guest
Jul 27th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.81 KB | None | 0 0
  1. <thead>
  2.  
  3. <tr>
  4. <th>Dongle</th>
  5. <th>ActDate</th>
  6. <th>ModDate</th>
  7. <th>Client</th>
  8. <th>Company</th>
  9. <th>Activation</th>
  10. <th>Comments</th>
  11. <th>Status</th>
  12. </tr>
  13.  
  14. </thead>
  15.  
  16. <SCRIPT type="text/javascript">
  17.  
  18. $(document).ready(function(){
  19. $('table tr').each(function(){
  20. if($(this).find('td').eq(3).text() == 'C'){
  21. $(this).css('background','red');
  22. }
  23. });
  24. });
  25.  
  26. </SCRIPT>
  27.  
  28. <?php
  29.  
  30. $queryString = $_SESSION['clientid'];
  31.  
  32. $Server = "somethingsqlexpress";
  33. $user = "some";
  34. $password = "thing";
  35.  
  36. $database = "Something";
  37. $connectionInfo = array( "Database"=>$database,"UID"=>$user, "PWD"=>$password);
  38. $link = sqlsrv_connect($Server, $connectionInfo);
  39.  
  40. if ($link === false) {
  41. echo "Connection failed. n";
  42. die(print_r(sqlsrv_errors(), true));
  43. }
  44.  
  45. $Reseller = $_SESSION["Seller"];
  46.  
  47. $strSQLSel= "SELECT Dongle AS Dongle, ActDate AS ActDate,
  48. ModDate AS ModDate, Client AS Client, Company AS Company,
  49. Activation AS Activation,
  50. Comments AS Comments, Status AS Status
  51. FROM Licenses
  52. WHERE Reseller = '$Reseller'
  53. GROUP BY Dongle,ActDate,ModDate,Client,Company,Activation,Comments,Status";
  54.  
  55. $result = sqlsrv_query($link,$strSQLSel);
  56. While ($row = sqlsrv_fetch_array($result,SQLSRV_FETCH_ASSOC)){
  57.  
  58. ?>
  59.  
  60. <tbody>
  61. <tr>
  62. <td><p><?php echo $row['Dongle']; ?></p></td>
  63. <td><p><?php echo date_format($row['ActDate'],'Y-m-d'); ?></p></td>
  64. <td><p><?php echo date_format($row['ModDate'],'Y-m-d'); ?></p></td>
  65. <td><p><?php echo $row['Client']; ?></p></td>
  66. <td><p><?php echo $row['Company']; ?></p></td>
  67. <td><p><?php echo $row['Activation']; ?></p></td>
  68. <td><p><?php echo $row['Comments']; ?></p></td>
  69. <td><p><?php echo $row['Status']; ?></p></td>
  70. </tr>
  71.  
  72. <?php
  73. }
  74. ?>
  75.  
  76. </tbody>
  77. </table>
  78.  
  79. tr.red-status {background-color: red;}
  80.  
  81. <tbody>
  82. <?php
  83. $result = sqlsrv_query($link, $strSQLSel);
  84. while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) :
  85. ?>
  86. <tr class="<?php echo ($row['Status'] == 'C') ? 'red-status' : '' ?>">
  87. <td><p><?php echo $row['Dongle']; ?></p></td>
  88. <td><p><?php echo date_format($row['ActDate'],'Y-m-d'); ?></p></td>
  89. <td><p><?php echo date_format($row['ModDate'],'Y-m-d'); ?></p></td>
  90. <td><p><?php echo $row['Client']; ?></p></td>
  91. <td><p><?php echo $row['Company']; ?></p></td>
  92. <td><p><?php echo $row['Activation']; ?></p></td>
  93. <td><p><?php echo $row['Comments']; ?></p></td>
  94. <td><p><?php echo $row['Status']; ?></p></td>
  95. </tr>
  96. <?php endwhile; ?>
  97. </tbody>
  98.  
  99. <tr style='<?php echo ($row["Status"] == "C") ? "background-color: red" : "" ?>'>
  100. <td><p><?php echo $row['Dongle']; ?></p></td>
  101. <td><p><?php echo date('Y-m-d', $row['ActDate']); ?></p></td>
  102. <td><p><?php echo date('Y-m-d', $row['ModDate']); ?></p></td>
  103. <td><p><?php echo $row['Client']; ?></p></td>
  104. <td><p><?php echo $row['Company']; ?></p></td>
  105. <td><p><?php echo $row['Activation']; ?></p></td>
  106. <td><p><?php echo $row['Comments']; ?></p></td>
  107. <td><p><?php echo $row['Status']; ?></p></td>
  108. </tr>
  109.  
  110. <tbody>
  111. while ($row = sqlsrv_fetch_array($result,SQLSRV_FETCH_ASSOC)){
  112. $cls = ($row['Activation']=='C') ? "style='background-color:red'" : "";
  113. ?>
  114.  
  115.  
  116. <tr <?php echo $cls;?>>
  117. <td><p><?php echo $row['Dongle']; ?></p></td>
  118. <td><p><?php echo date_format($row['ActDate'],'Y-m-d'); ?></p></td>
  119. <td><p><?php echo date_format($row['ModDate'],'Y-m-d'); ?></p></td>
  120. <td><p><?php echo $row['Client']; ?></p></td>
  121. <td><p><?php echo $row['Company']; ?></p></td>
  122. <td><p><?php echo $row['Activation']; ?></p></td>
  123. <td><p><?php echo $row['Comments']; ?></p></td>
  124. <td><p><?php echo $row['Status']; ?></p></td>
  125. </tr>
  126.  
  127. <?php
  128. }
  129. ?>
  130.  
  131. EASY TO USE AND VERY SIMPLE:
  132.  
  133. $(document).ready(function () {
  134. $(".searchCls").val("");
  135. //Script to search item group in table
  136. $('.searchCls').keyup(function () {
  137. var inputval = $(this).val();
  138. var table = $('#WBSTreeList');
  139. var search = $('.searchCls');
  140. if(inputval != '' && inputval != null){
  141. table.find('tr').each(function (index, row) {
  142. var allCells = $(row).find('td');
  143. if (allCells.length > 0) {
  144. var found = false;
  145. allCells.each(function (index, td) {
  146. var regExp = new RegExp(inputval, 'i');
  147. if (regExp.test($(td).text())) {
  148. found = true;
  149. return false;
  150. }
  151. });
  152. if (found == true) {
  153. $(row).show().addClass('match');
  154. }
  155.  
  156. else {
  157. $(row).hide();
  158. }
  159. }
  160. });
  161. }
  162. else {
  163. table.find('tr').each(function (index, row) {
  164. $(row).show().removeClass('match');
  165. });
  166. }
  167. });
  168. });
  169.  
  170. HTML:
  171. <input type="text" id="searchtxt" class="searchCls width-100" placeholder="Search ...">
  172.  
  173. <div class="col-sm-12 col-xs-12 table-responsive">
  174. <table id="WBSTreeList" class="table table-bordered width-100">
  175. <thead>
  176. <tr>
  177. <th></th>
  178. <th></th>
  179. </tr>
  180. </thead>
  181. <tbody>
  182. <tr>
  183. <td>
  184. </td>
  185. </tr>
  186. </tbody>
  187. </table>
  188. </div>
Add Comment
Please, Sign In to add comment