AhmedAdil

LoadEmp.php

Apr 25th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. <?php
  2. session_start(); // NEVER forget this!
  3. $con = mysql_connect("localhost","root","") or die('Could not connect: ' . mysql_error());
  4. mysql_select_db("webauth", $con);
  5. $myusername = $_SESSION['myusername'];
  6. //$result = mysql_query("SELECT * FROM user_pwd");
  7. $sql5 = "SELECT dept from `user_pwd` WHERE name = '$myusername'";
  8. $result5=mysql_query($sql5, $con);
  9. $row5=mysql_fetch_assoc($result5);
  10. // echo "<br />";
  11. $url3 = 'http://localhost:1090/WebEmpLoad.hal';
  12. $myvars3 = 'department='.$row5['dept'];
  13. mysql_close($con);
  14. $ch3 = curl_init( $url3 );
  15. curl_setopt( $ch3, CURLOPT_POST, 1);
  16. curl_setopt( $ch3, CURLOPT_POSTFIELDS, $myvars3);
  17. curl_setopt( $ch3, CURLOPT_FOLLOWLOCATION, 1);
  18. curl_setopt( $ch3, CURLOPT_HEADER, 0);
  19. curl_setopt( $ch3, CURLOPT_RETURNTRANSFER, 1);
  20. $response3 = curl_exec( $ch3 );
  21. //echo $response3;
  22. $arr = (explode(',',$response3,100));
  23. print_r(explode(',',$response3,-1));
  24. $Num = sizeof($arr);
  25. $rows = ($Num - 1)/2;
  26. echo $rows;
  27. echo "<table>";
  28. $col = "left";
  29.  
  30. ?>
  31.  
  32. <table align="center" id="dataTable">
  33. <tr class="header">
  34. <td />
  35. <td class="text ce6">Emp code</td>
  36. <td class="text ce6">Name</td>
  37. <td class="text ce6">Department codes</td>
  38. <td class="text ce7">1</td>
  39. <td class="text ce7">2</td>
  40. <td class="text ce7">3</td>
  41. <td class="text ce7">4</td>
  42. <td class="text ce7">5</td>
  43. <td class="text ce7">6</td>
  44. <td class="text ce7">7</td>
  45. <td class="text ce7">8</td>
  46. <td class="text ce7">9</td>
  47. <td class="text ce7">10</td>
  48. <td class="text ce7">11</td>
  49. <td class="text ce7">12</td>
  50. <td class="text ce7">13</td>
  51. <td class="text ce7">14</td>
  52. <td class="text ce7">15</td>
  53. <td class="text ce7">16</td>
  54. <td class="text ce7">17</td>
  55. <td class="text ce7">18</td>
  56. <td class="text ce7">19</td>
  57. <td class="text ce7">20</td>
  58. <td class="text ce7">21</td>
  59. <td class="text ce7">22</td>
  60. <td class="text ce7">23</td>
  61. <td class="text ce7">24</td>
  62. <td class="text ce7">25</td>
  63. <td class="text ce7">26</td>
  64. <td class="text ce7">27</td>
  65. <td class="text ce7">28</td>
  66. <td class="text ce7">29</td>
  67. <td class="text ce7">30</td>
  68. <td class="text ce7">31</td>
  69. </tr>
  70.  
  71. <tbody>
  72.  
  73. <tr>
  74. <TD><INPUT type="checkbox" name="chk"/></TD>
  75. <?php
  76.  
  77. if (is_array($arr)) {
  78. foreach($arr as $arr){
  79. if($col == "left"){
  80. echo "<tr><td>$arr</td>";
  81. $col = "right";
  82. }else{
  83. echo "<td>$arr</td></tr>";
  84. $col = "left";
  85. }
  86. }
  87. }
  88. echo "</table>";
  89. ?>
  90. <td class="text ce2"><INPUT type="text" name="code" size = "12" value="<?php
  91. echo $arr;
  92. ?>"/></td>
  93. <td class="text ce2"><INPUT type="text" name="name" size = "60" value="<?php
  94. echo $arr;
  95. ?>"/></td>
  96. </tr>
Advertisement
Add Comment
Please, Sign In to add comment