Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. function random()
  2. {
  3. include('config/koneksi.php');
  4. $result = mysql_query("select * from temp_hasil");
  5. $n =mysql_num_rows(mysql_query("SELECT * FROM temp_hasil"));
  6.  
  7. for ($i = 1; $i <= $n; $i++)
  8. {
  9.  
  10. for ($j = 1; $j <= $n; $j++)
  11. {
  12.  
  13. $rows = mysql_fetch_array($result);
  14.  
  15.  
  16. $this->table[$i][$j] = $i == $j ? INF : $rows['id'];
  17.  
  18.  
  19. }
  20. }
  21. }
  22.  
  23. function __toString()
  24. {
  25. $str = '<table class="table table-bordered" id="tableInput"> <tbody>';
  26. $str .= '<tr><td></td>';
  27. foreach ($this->table as $rowName => $row)
  28. {
  29. $str .= "<td>$rowName</td>";
  30. }
  31. $str .= '</tr>';
  32. foreach ($this->table as $rowName => $row)
  33. {
  34. $str .= "<tr><td>$rowName</td>";
  35. foreach ($row as $columnName => $value)
  36. {
  37. $str .= "<td>";
  38. $str .=
  39. '<input class="form-control" type="text" value="' . $value . '" name="table[' . $rowName . '][' .
  40. $columnName . ']" requied' . ($columnName == $rowName ? ' disabled' : '') . '>';
  41. $str .= "</td>";
  42. }
  43. $str .= '</tr>';
  44. }
  45. $str .= '</tbody></table>';
  46. return $str;
  47. }
  48.  
  49. }
  50. $str .= '</tr>';
  51. foreach ($this->table as $rowName => $row)
  52. {
  53. $str .= "<tr><td>$rowName</td>";
  54. foreach ($row as $columnName => $value)
  55. {
  56. $str .= "<td>";
  57. $str .=
  58. '<input class="form-control" type="text" value="' . $value . '" name="table[' . $rowName . '][' .
  59. $columnName . ']" requied' . ($columnName == $rowName ? ' disabled' : '') . '>';
  60. $str .= "</td>";
  61. }
  62. $str .= '</tr>';
  63. }
  64. $str .= '</tbody></table>';
  65. return $str;
  66. }`
  67.  
  68. function random()
  69. {
  70. include('config/koneksi.php');
  71. $result = mysql_query("select * from temp_hasil");
  72. $n =mysql_num_rows(mysql_query("SELECT * FROM temp_hasil"));
  73.  
  74. for ($i = 1; $i <= $n; $i++)
  75. {
  76.  
  77. for ($j = 1; $j <= $n; $j++)
  78. {
  79.  
  80. $rows = mysql_fetch_array($result);
  81.  
  82.  
  83. $this->table[$i][$j] = $i == $j ? INF : $rows['id'];
  84.  
  85.  
  86. }
  87. }
  88. }
  89.  
  90. function __toString()
  91. {
  92. $str = '<table class="table table-bordered" id="tableInput"> <tbody>';
  93. $str .= '<tr><td></td>';
  94. foreach ($this->table as $rowName => $row)
  95. {
  96. $str .= "<td>$rowName</td>";
  97. }
  98. $str .= '</tr>';
  99. foreach ($this->table as $rowName => $row)
  100. {
  101. $str .= "<tr><td>$rowName</td>";
  102. foreach ($row as $columnName => $value)
  103. {
  104. $str .= "<td>";
  105. $str .=
  106. '<input class="form-control" type="text" value="' . $value . '" name="table[' . $rowName . '][' .
  107. $columnName . ']" requied' . ($columnName == $rowName ? ' disabled' : '') . '>';
  108. $str .= "</td>";
  109. }
  110. $str .= '</tr>';
  111. }
  112. $str .= '</tbody></table>';
  113. return $str;
  114. }
  115.  
  116. }
  117. $str .= '</tr>';
  118. foreach ($this->table as $rowName => $row)
  119. {
  120. $str .= "<tr><td>$rowName</td>";
  121. foreach ($row as $columnName => $value)
  122. {
  123. $str .= "<td>";
  124. $str .=
  125. '<input class="form-control" type="text" value="' . $value . '" name="table[' . $rowName . '][' .
  126. $columnName . ']" requied' . ($columnName == $rowName ? ' disabled' : '') . '>';
  127. $str .= "</td>";
  128. }
  129. $str .= '</tr>';
  130. }
  131. $str .= '</tbody></table>';
  132. return $str;
  133. }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement