Counter

Bli putu, mau tanya.
Bgm cara membuat counter dari sejumlah angka di suatu field pada table, dimana angka tsb merupakan angka dari suatu pengurangan dua buah waktu sehingga didapat sejumlah angka detikan.
Program counter tersebut adalah untuk mengurangi sejumlah angka tsb setiap detiknya, sambil menampilkan siswa angka berupa waktu (menit dan detik).
Bisa dibantu untuk algoritma/pun pseucode/ programnya? suksma
Please login to answer!
Masalahnya cuma gak refresh atau gak kembali ke menu yg telah diedit. Tetapi data yang diedit tersimpan.
mohon bantuan,terimakasih
  1.  
  2. <fieldset>
  3. <legend>Edit Soal Tugas</legend>
  4.  
  5. <?php
  6. $id = @$_GET['id'];
  7. $sql = mysql_query("select * from soaltugas where id = '$id'") or die (mysql_error());
  8. $data = mysql_fetch_array($sql);
  9. ?>
  10. <form action="" method="post" enctype="multipart/form-data">
  11. <table>
  12. <tr>
  13. <td>id</td>
  14. <td>:</td>
  15. <td><input type="text" name="id" value="<?php echo $data['id']; ?>" /></td>
  16. </tr>
  17. <tr>
  18. <td>judul_tugas</td>
  19. <td>:</td>
  20. <td><input type="text" name="judul_tugas" value="<?php echo $data['judul_tugas']; ?>" /></td>
  21. </tr>
  22. <tr>
  23. <td>kode_matkul</td>
  24. <td>:</td>
  25. <td><input type="text" name="kode_matkul" value="<?php echo $data['kode_matkul']; ?>" /></td>
  26. </tr>
  27. <tr>
  28. <td>keterangan</td>
  29. <td>:</td>
  30. <td><input type="text" name="keterangan" value="<?php echo $data['keterangan']; ?>" /></td>
  31. </tr>
  32. <tr>
  33. <td>filename</td>
  34. <td>:</td>
  35. <td><input type="text" name="filename" value="<?php echo $data['filename']; ?>" /></td>
  36. </tr>
  37. <tr>
  38. <td>location</td>
  39. <td>:</td>
  40. <td><input type="text" name="location" value="<?php echo $data['location']; ?>" /></td>
  41. </tr>
  42. <tr>
  43. <td></td>
  44. <td></td>
  45. <td><input type="submit" name="edit" value="Edit" /></td>
  46. </tr>
  47. </table>
  48. </form>
  49. <?php
  50. $id = @$_POST['id'];
  51. $judul_tugas = @$_POST['judul_tugas'];
  52. $kode_matkul = @$_POST['kode_matkul'];
  53. $keterangan = @$_POST['keterangan'];
  54. $filename = @$_POST['filename'];
  55. $location = @$_POST['location'];
  56.  
  57. $edit_soal = @$_POST['edit_soal'];
  58.  
  59. if($edit_soal) {
  60. if($id == "" || $judul_tugas == "" || $kode_matkul == "" || $keterangan == "" || $filename == "" || $location == "")
  61. ?>
  62. <script type="text/javascript">
  63. alert("tidak boleh ada yang kosong");
  64. </script>
  65. <?php
  66. } else {
  67. mysql_query("update soaltugas set
  68. judul_tugas = '$_POST[judul_tugas]',
  69. kode_matkul = '$_POST[kode_matkul]',
  70. keterangan = '$_POST[keterangan]',
  71. filename = '$_POST[filename]',
  72. location = '$_POST[location]'
  73. where id = '$_POST[id]'") or die (mysql_error());
  74.  
  75. if($edit_soal) {
  76. echo"Data telah diupdate";
  77. echo"<meta http-equiv='refresh' content='1; url=?page=Soal Tugas'>";
  78. }
  79. }
  80. ?>
  81. </fieldset>
Please login to answer!
hallo ka. mau tanya dong, ko saya bikin form kuesioner tp ga bisa input dan simpn ya ?? help plis thx
Please login to answer!
mohon bantuan
ini soal saya sudah random tpi opsi nya belum random
dibagian mana yaaa utk meletakkan random nya?
  1. <?php
  2. session_start();
  3. error_reporting(0);
  4.  
  5. if (empty($_SESSION['username']) AND empty($_SESSION['passuser']) AND $_SESSION['login']==0){
  6. echo "<link href='css/screen.css' rel='stylesheet' type='text/css'><link href='css/reset.css' rel='stylesheet' type='text/css'>
  7.  
  8.  
  9. <center><br><br><br><br><br><br>Maaf, untuk masuk <b>Halaman</b><br>
  10. <center>Anda harus <b>Login</b> dahulu!<br><br>";
  11. echo "<div> <a href='index.php'><img src='images/kunci.png' height=176 width=143></a>
  12. </div>";
  13. echo "<input type=button class=simplebtn value='LOGIN DI SINI' onclick=location.href='index.php'></a></center>";
  14. }
  15. else{
  16. ?>
  17.  
  18. <html>
  19. <header>
  20. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  21. <meta name="description" content=""/>
  22. <meta name="keywords" content=""/>
  23. <meta name="robots" content="ALL,FOLLOW"/>
  24. <meta name="Author" content="Rizal Faizal"/>
  25. <meta http-equiv="imagetoolbar" content="no"/>
  26. <title>.::Halaman Tugas / Quiz::.</title>
  27. <link rel="shortcut icon" type="image/x-icon" href="images/favicon.png">
  28. <link rel="stylesheet" href="css/reset.css" type="text/css"/>
  29. <link rel="stylesheet" href="css/screen2.css" type="text/css"/>
  30. <link rel="stylesheet" href="css/fancybox.css" type="text/css"/>
  31. <link rel="stylesheet" href="css/jquery.wysiwyg.css" type="text/css"/>
  32. <link rel="stylesheet" href="css/jquery.ui.css" type="text/css"/>
  33. <link rel="stylesheet" href="css/visualize.css" type="text/css"/>
  34. <link rel="stylesheet" href="css/visualize-light.css" type="text/css"/>
  35.  
  36.  
  37. <script type="text/javascript" src="js/jquery.js"></script>
  38. <script type="text/javascript" src="js/jquery.visualize.js"></script>
  39. <script type="text/javascript" src="js/jquery.wysiwyg.js"></script>
  40. <script type="text/javascript" src="js/tiny_mce/jquery.tinymce.js"></script>
  41. <script type="text/javascript" src="js/jquery.fancybox.js"></script>
  42. <script type="text/javascript" src="js/jquery.idtabs.js"></script>
  43. <script type="text/javascript" src="js/jquery.datatables.js"></script>
  44. <script type="text/javascript" src="js/jquery.jeditable.js"></script>
  45. <script type="text/javascript" src="js/jquery.ui.js"></script>
  46. <script type="text/javascript" src="js/clock.js"></script>
  47.  
  48. <script type="text/javascript" src="js/excanvas.js"></script>
  49. <script type="text/javascript" src="js/cufon.js"></script>
  50. <script type="text/javascript" src="js/Geometr231_Hv_BT_400.font.js"></script>
  51.  
  52. <script language="javascript" type="text/javascript">
  53. tinyMCE_GZ.init({
  54. plugins : 'style,layer,table,save,advhr,advimage, ...',
  55. themes : 'simple,advanced',
  56. languages : 'en',
  57. disk_cache : true,
  58. debug : false
  59. });
  60. </script>
  61. <script language="javascript" type="text/javascript"
  62. src="../tinymcpuk/tiny_mce_src.js"></script>
  63. <script type="text/javascript">
  64. tinyMCE.init({
  65. mode : "textareas",
  66. theme : "advanced",
  67. plugins : "table,youtube,advhr,advimage,advlink,emotions,flash,searchreplace,paste,directionality,noneditable,contextmenu",
  68. theme_advanced_buttons1_add : "fontselect,fontsizeselect",
  69. theme_advanced_buttons2_add : "separator,preview,zoom,separator,forecolor,backcolor,liststyle",
  70. theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
  71. theme_advanced_buttons3_add_before : "tablecontrols,separator,youtube,separator",
  72. theme_advanced_buttons3_add : "emotions,flash",
  73. theme_advanced_toolbar_location : "top",
  74. theme_advanced_toolbar_align : "left",
  75. theme_advanced_statusbar_location : "bottom",
  76. extended_valid_elements : "hr[class|width|size|noshade]",
  77. file_browser_callback : "fileBrowserCallBack",
  78. paste_use_dialog : false,
  79. theme_advanced_resizing : true,
  80. theme_advanced_resize_horizontal : false,
  81. theme_advanced_link_targets : "_something=My somthing;_something2=My somthing2;_something3=My somthing3;",
  82. apply_source_formatting : true
  83. });
  84.  
  85. function fileBrowserCallBack(field_name, url, type, win) {
  86. var connector = "../../filemanager/browser.html?Connector=connectors/php/connector.php";
  87. var enableAutoTypeSelection = true;
  88.  
  89. var cType;
  90. tinymcpuk_field = field_name;
  91. tinymcpuk = win;
  92.  
  93. switch (type) {
  94. case "image":
  95. cType = "Image";
  96. break;
  97. case "flash":
  98. cType = "Flash";
  99. break;
  100. case "file":
  101. cType = "File";
  102. break;
  103. }
  104.  
  105. if (enableAutoTypeSelection && cType) {
  106. connector += "&Type=" + cType;
  107. }
  108.  
  109. window.open(connector, "tinymcpuk", "modal,width=600,height=400");
  110. }
  111. </script>
  112.  
  113. <style type="text/css">
  114. <!--
  115. .style3 {
  116. color: #62A621;
  117. font-weight: bold;
  118. }
  119. .garisbawah {
  120. padding-bottom: 5px;
  121. border-bottom: 1px dotted #CCC;
  122. }
  123. -->
  124. </style>
  125. <script>
  126. var waktunya;
  127. waktunya = <?php echo "$_POST[waktu]"; ?>;
  128. var waktu;
  129. var jalan = 0;
  130. var habis = 0;
  131. function init(){
  132. checkCookie()
  133. mulai();
  134. }
  135. function keluar(){
  136. if(habis==0){
  137. setCookie('waktux',waktu,365);
  138. }else{
  139. setCookie('waktux',0,-1);
  140. }
  141. }
  142. function mulai(){
  143. jam = Math.floor(waktu/3600);
  144. sisa = waktu%3600;
  145. menit = Math.floor(sisa/60);
  146. sisa2 = sisa%60
  147. detik = sisa2%60;
  148. if(detik<10){
  149. detikx = "0"+detik;
  150. }else{
  151. detikx = detik;
  152. }
  153. if(menit<10){
  154. menitx = "0"+menit;
  155. }else{
  156. menitx = menit;
  157. }
  158. if(jam<10){
  159. jamx = "0"+jam;
  160. }else{
  161. jamx = jam;
  162. }
  163. document.getElementById("divwaktu").innerHTML = jamx+" H : "+menitx+" M : "+detikx +" S";
  164. waktu --;
  165. if(waktu>0){
  166. t = setTimeout("mulai()",1000);
  167. jalan = 1;
  168. }else{
  169. if(jalan==1){
  170. clearTimeout(t);
  171. }
  172. habis = 1;
  173. document.getElementById("formulir").submit();
  174. }
  175. }
  176. function selesai(){
  177. if(jalan==1){
  178. clearTimeout(t);
  179. }
  180. habis = 1;
  181. document.getElementById("formulir").submit();
  182. }
  183. function getCookie(c_name){
  184. if (document.cookie.length>0){
  185. c_start=document.cookie.indexOf(c_name + "=");
  186. if (c_start!=-1){
  187. c_start=c_start + c_name.length+1;
  188. c_end=document.cookie.indexOf(";",c_start);
  189. if (c_end==-1) c_end=document.cookie.length;
  190. return unescape(document.cookie.substring(c_start,c_end));
  191. }
  192. }
  193. return "";
  194. }
  195.  
  196. function setCookie(c_name,value,expiredays){
  197. var exdate=new Date();
  198. exdate.setDate(exdate.getDate()+expiredays);
  199. document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  200. }
  201.  
  202. function checkCookie(){
  203. waktuy=getCookie('waktux');
  204. if (waktuy!=null && waktuy!=""){
  205. waktu = waktuy;
  206. }else{
  207. waktu = waktunya;
  208. setCookie('waktux',waktunya,7);
  209. }
  210. }
  211.  
  212. </script>
  213. <script type="text/javascript">
  214. window.history.forward();
  215. function noBack(){ window.history.forward(); }
  216. </script>
  217. <script type="text/javascript">
  218. function tombol()
  219. {
  220. document.getElementById("tombol").innerHTML= "<input type=button value=Simpan onclick=selesai()>";
  221. }
  222. </script>
  223. </header>
  224. <body onLoad="init(),noBack();" onpageshow="if (event.persisted) noBack();" onUnload="keluar()">
  225. <div class="sidebar">
  226. <div class="logo2 clear"><img src="" alt="" width="" height="" /></div>
  227. <div class="waktu">
  228. <ul><li><a>Sisa Waktu Anda</a>
  229. <ul>
  230. <div id=divwaktu></div>
  231. </ul>
  232. </li>
  233. </ul></div>
  234. </div>
  235.  
  236.  
  237. <div class="main"> <!-- *** mainpage layout *** -->
  238. <div class="main-wrap">
  239. <div class="header clear">
  240. </div>
  241.  
  242. <div class="page clear">
  243. <!-- MODAL WINDOW -->
  244. <div id="modal" class="modal-window">
  245. <!-- <div class="modal-head clear"><a onclick="$.fancybox.close();" href="javascript:;" class="close-modal">Close</a></div> -->
  246.  
  247.  
  248. </div>
  249.  
  250. <!-- CONTENT BOXES -->
  251. <!-- end of content-box -->
  252. <div class="notification note-success">
  253. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  254. <tr>
  255. <td width="2%">&nbsp;</td>
  256. <td width="95%">
  257.  
  258. <form action=nilai.php method=post id=formulir>
  259.  
  260. <?php
  261. include "configurasi/koneksi.php";
  262. $cek_siswa = mysql_query("SELECT * FROM siswa_sudah_mengerjakan WHERE id_tq='$_POST[id]' AND id_siswa='$_SESSION[idsiswa]'");
  263. $info_siswa = mysql_fetch_array($cek_siswa);
  264. if ($info_siswa[hits]<= 0){
  265. mysql_query("INSERT INTO siswa_sudah_mengerjakan (id_tq,id_siswa,hits)
  266. VALUES ('$_POST[id]','$_SESSION[idsiswa]',hits+1)");
  267. }
  268. elseif ($info_siswa[hits] > 0){
  269. }
  270.  
  271. $soal = mysql_query("SELECT * FROM quiz_pilganda where id_tq='$_POST[id]' ORDER BY rand()");
  272. $pilganda = mysql_num_rows($soal);
  273. $soal_esay = mysql_query("SELECT * FROM quiz_esay WHERE id_tq='$_POST[id]'");
  274. $esay = mysql_num_rows($soal_esay);
  275. if (!empty($pilganda) AND !empty($esay)){
  276. echo "<br><b class='judul'>Daftar Soal Pilihan Ganda</b><br><p class='garisbawah'></p>
  277. <table><input type=hidden name=id_topik value='$_POST[id]'>";
  278.  
  279. $no = 1;
  280. while($s = mysql_fetch_array($soal)){
  281. if ($s[gambar]!=''){
  282. echo "<tr><td rowspan=6><h3>$no.</h3></td><td><h3>".$s['pertanyaan']."</h3></td></tr>";
  283. echo "<tr><td><img src='foto_soal_pilganda/medium_$s[gambar]'></td></tr>";
  284. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='A'>A. ".$s['pil_a']."</td></tr>";
  285. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='B'>B. ".$s['pil_b']."</td></tr>";
  286. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='C'>C. ".$s['pil_c']."</td></tr>";
  287. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='D'>D. ".$s['pil_d']."</td></tr>";
  288. }else{
  289. echo "<tr><td rowspan=5><h3>$no.</h3></td><td><h3>".$s['pertanyaan']."</h3></td></tr>";
  290. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='A'>A. ".$s['pil_a']."</td></tr>";
  291. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='B'>B. ".$s['pil_b']."</td></tr>";
  292. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='C'>C. ".$s['pil_c']."</td></tr>";
  293. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='D'>D. ".$s['pil_d']."</td></tr>";
  294. }
  295. $no++;
  296. }
  297. echo "</table>";
  298. echo "<br><b class='judul'>Daftar Soal Essay</b><br><p class='garisbawah'></p>
  299. <table>";
  300. $no2=1;
  301. while($e= mysql_fetch_array($soal_esay)){
  302. if (!empty($e[gambar])){
  303. echo "<tr><td rowspan=4><h3>$no2.</h3></td><td><h3>".$e['pertanyaan']."</h3></td></tr>";
  304. echo "<tr><td><img src='foto_soal/medium_$e[gambar]'></td></tr>";
  305. echo "<tr><td>Jawaban : </td></tr>";
  306. echo "<tr><td><textarea name=soal_esay[".$e['id_quiz']."] cols=95 rows=5></textarea></td></tr>";
  307. }else{
  308. echo "<tr><td rowspan=3><h3>$no2.</h3></td><td><h3>".$e['pertanyaan']."</h3></td></tr>";
  309. echo "<tr><td>Jawaban : </td></tr>";
  310. echo "<tr><td><textarea name=soal_esay[".$e['id_quiz']."] cols=95 rows=5></textarea></td></tr>";
  311. }
  312. $no2++;
  313. }
  314. echo "</table>";
  315. $jumlahsoal = $no - 1;
  316. echo "<input type=hidden name=jumlahsoalpilganda value=$jumlahsoal>";
  317. }
  318.  
  319. elseif (!empty($pilganda) AND empty($esay)){
  320. echo "<br><b class='judul'>Daftar Soal Pilihan Ganda</b><br><p class='garisbawah'></p>
  321. <table><input type=hidden name=id_topik value='$_POST[id]'>";
  322.  
  323. $no = 1;
  324. while($s = mysql_fetch_array($soal)){
  325. if ($s[gambar]!=''){
  326. echo "<tr><td rowspan=6><h3>$no.</h3></td><td><h3>".$s['pertanyaan']."</h3></td></tr>";
  327. echo "<tr><td><img src='foto_soal_pilganda/medium_$s[gambar]'></td></tr>";
  328. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='A'>A. ".$s['pil_a']."</td></tr>";
  329. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='B'>B. ".$s['pil_b']."</td></tr>";
  330. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='C'>C. ".$s['pil_c']."</td></tr>";
  331. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='D'>D. ".$s['pil_d']."</td></tr>";
  332. }else{
  333. echo "<tr><td rowspan=5><h3>$no.</h3></td><td><h3>".$s['pertanyaan']."</h3></td></tr>";
  334. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='A'>A. ".$s['pil_a']."</td></tr>";
  335. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='B'>B. ".$s['pil_b']."</td></tr>";
  336. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='C'>C. ".$s['pil_c']."</td></tr>";
  337. echo "<tr><td><input type=radio name=soal_pilganda[".$s['id_quiz']."] value='D'>D. ".$s['pil_d']."</td></tr>";
  338. }
  339. $no++;
  340. }
  341. echo "</table>";
  342. $jumlahsoal = $no - 1;
  343. echo "<input type=hidden name=jumlahsoalpilganda value=$jumlahsoal>";
  344. }
  345. elseif (empty($pilganda) AND !empty($esay)){
  346. echo "<br><b class='judul'>Daftar Soal Essay</b><br><p class='garisbawah'></p>
  347. <table><input type=hidden name=id_topik value='$_POST[id]'>";
  348. $no2=1;
  349. while($e= mysql_fetch_array($soal_esay)){
  350. if (!empty($e[gambar])){
  351. echo "<tr><td rowspan=4><h3>$no2.</h3></td><td><h3>".$e['pertanyaan']."</h3></td></tr>";
  352. echo "<tr><td><img src='foto_soal/medium_$e[gambar]'></td></tr>";
  353. echo "<tr><td>Jawaban : </td></tr>";
  354. echo "<tr><td><textarea name=soal_esay[".$e['id_quiz']."] cols=95 rows=10></textarea></td></tr>";
  355. }else{
  356. echo "<tr><td rowspan=3><h3>$no2.</h3></td><td><h3>".$e['pertanyaan']."</h3></td></tr>";
  357. echo "<tr><td>Jawaban : </td></tr>";
  358. echo "<tr><td><textarea name=soal_esay[".$e['id_quiz']."] cols=95 rows=10></textarea></td></tr>";
  359. }
  360. $no2++;
  361. }
  362. echo "</table>";
  363. }
  364. elseif (empty($pilganda) AND empty($esay)){
  365. echo "<script>window.alert('Maaf belum ada soal di Topik Ini.');
  366. window.location=(href='media.php?module=home')</script>";
  367. }
  368. ?>
  369. <br><p class='garisbawah'></p>
  370. <h3>Apakah anda sudah yakin dengan jawaban anda dan ingin menyimpannya? <button type=button onClick="tombol()">Ya</button></h3>
  371. <h3 id="tombol"></h3>
  372. </form>
  373. </td>
  374. <td width="3%">&nbsp;</td>
  375. </tr>
  376. </table>
  377. </div>
  378. <div class="clear">
  379. <!-- end of content-box -->
  380.  
  381. </div><!-- end of page -->
  382.  
  383. <div class="footer clear"></div>
  384. </div>
  385. </div>
  386. </div>
  387. <script type="text/javascript">
  388.  
  389. var _gaq = _gaq || [];
  390. _gaq.push(['_setAccount', 'UA-12958851-7']);
  391. _gaq.push(['_trackPageview']);
  392.  
  393. (function() {
  394. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  395. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  396. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  397. })();
  398.  
  399. </script>
  400. </body>
  401.  
  402. <meta http-equiv="content-type" content="text/html;charset=UTF-8">
  403. </body>
  404. </html>
  405. <?php
  406. }
  407. ?>
  408.  
Please login to answer!
Salam,
Mas, bagaimana caranya menyimpan 1 Combobox dan 1 textbox atau lebih ke 1 field database(satu value dia..) ?? Saya cari-cari tidak ketemu. Mohon pencerahannya.
Please login to answer!
Dear para master mohon bantuannya saya sudah sangat stuck, kira2 apakah bisa dan bagaimana menggabungkan 3 query sql menjadi 1 sql query karena ingin ku jadikan (while) dengan syatax sql sebagai berikut,Terima kasih banyak sebelumnya dan mohon bantuannya.
  1. //sql pertama
  2. $sql1="select SUM(nom_bunga) as nom_bunga, tgl_entry from angsuran group by MONTHNAME(tgl_entry), YEAR(tgl_entry) order by tgl_entry desc";
  3.  
  4. //sql kedua
  5. $sql2="select SUM(tabungan) as tabungan, MONTHNAME(tanggal_simpan) as bulan, YEAR(tanggal_simpan) as tahun, (select SUM(tabungan) from simpanan b where jenis = 'SIMPANAN WAJIB' and MONTHNAME(a.tanggal_simpan) = MONTHNAME(b.tanggal_simpan) and YEAR(a.tanggal_simpan) = YEAR(b.tanggal_simpan)) as wajib, (select SUM(tabungan) from simpanan c where jenis = 'SIMPANAN POKOK' and MONTHNAME(a.tanggal_simpan) = MONTHNAME(c.tanggal_simpan) and YEAR(a.tanggal_simpan) = YEAR(c.tanggal_simpan)) as pokok from simpanan a group by MONTHNAME(tanggal_simpan), YEAR(tanggal_simpan) order by tanggal_simpan asc";
  6.  
  7. //sql ketiga
  8.  
  9. $date1=date('Y-m-d');//variabel date
  10. $sql2="select a.tabungan as shu, id_simpan, nopeg, nama, department, unit, jenis, besar, (SELECT b.tabungan FROM simpanan b where a.id_simpan = b.id_simpan and b.status='Aktif' AND b.jenis='Simpanan Wajib' and b.tanggal_simpan in (SELECT MAX(c.tanggal_simpan) FROM simpanan c where c.jenis = 'Simpanan Wajib' and c.id_simpan = b.id_simpan)) as wajib from simpanan a where a.jenis='Simpanan SHU' and a.tanggal_simpan <= '$date' ORDER BY `a`.`id_simpan` ASC";
Please login to answer!