<%@page import="java.sql.ResultSet"%> <%@page import="java.sql.Statement"%> <%@page import="java.sql.DriverManager"%> <%@page import="java.sql.PreparedStatement"%> <%@page import="java.sql.Connection"%> <%@page contentType="text/html" pageEncoding="UTF-8"%>

Pungutan Pingat Mengikut Sukan Dan Kontinjen SUTERA 2019

<% String Hostxxx = "jdbc:mysql://localhost:3306/ifastdem_webmsnt"; Connection connectionxxx = null; Statement statementxxx = null; ResultSet rsxxx = null; Class.forName("com.mysql.jdbc.Driver"); connectionxxx = DriverManager.getConnection(Hostxxx, "ifastdem_admin", "P@s$w()rd"); statementxxx = connectionxxx.createStatement(); // String Data = "select negeri, emas, perak, gangsa, (emas + perak + gangsa) AS jumlah from pingat order by emas desc, perak desc, gangsa desc, negeri "; String Dataxxx = "select a.*, IF(b.j_emas IS NULL,0,b.j_emas) emas, IF(c.j_perak IS NULL,0,c.j_perak) perak, IF(d.j_gangsa IS NULL,0,d.j_gangsa) + IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa, IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa_2,(IF(b.j_emas IS NULL,0,b.j_emas)+IF(c.j_perak IS NULL,0,c.j_perak)+IF(d.j_gangsa IS NULL,0,d.j_gangsa)+IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2)) AS tot from kod_daerah a LEFT JOIN (SELECT emas,sum(1) AS j_emas FROM keputusan WHERE type = 2 AND emas != '' GROUP BY emas) b ON b.emas = a.idDaerah LEFT JOIN (SELECT perak,sum(1) AS j_perak FROM keputusan WHERE type = 2 AND perak != '' GROUP BY perak) c ON c.perak = a.idDaerah LEFT JOIN (SELECT gangsa,sum(1) AS j_gangsa FROM keputusan WHERE type = 2 AND gangsa != '' GROUP BY gangsa) d ON d.gangsa = a.idDaerah LEFT JOIN (SELECT gangsa_2,sum(1) AS j_gangsa_2 FROM keputusan WHERE type = 2 AND gangsa_2 != '' GROUP BY gangsa_2) e ON e.gangsa_2 = a.idDaerah ORDER BY a.daerah ASC,b.j_emas DESC,c.j_perak DESC,(d.j_gangsa+e.j_gangsa_2) DESC"; // out.print(Dataxxx); rsxxx = statementxxx.executeQuery(Dataxxx); Integer cnt = 0; while (rsxxx.next()) { %> <% cnt++; } %> <% for(int i = 0; i < cnt; i+=1){ %> <% } %> <% String Hostx = "jdbc:mysql://localhost:3306/ifastdem_webmsnt"; Connection connectionx = null; Statement statementx = null; ResultSet rsx = null; Class.forName("com.mysql.jdbc.Driver"); connectionx = DriverManager.getConnection(Hostx, "ifastdem_admin", "P@s$w()rd"); statementx = connectionx.createStatement(); // String Data = "select negeri, emas, perak, gangsa, (emas + perak + gangsa) AS jumlah from pingat order by emas desc, perak desc, gangsa desc, negeri "; String Datax = "SELECT a.kod_kategori,b.sukan,b.kod_sukan FROM keputusan a left join kod_kategori b on b.idKategori = a.kod_kategori where b.idKategori IS NOT NULL and a.type = 2 group by b.kod_sukan"; rsx = statementx.executeQuery(Datax); Integer xx1 = 1; while (rsx.next()) { %> <% String uid = rsx.getString("kod_sukan"); String Hostxx = "jdbc:mysql://localhost:3306/ifastdem_webmsnt"; Connection connectionxx = null; Statement statementxx = null; ResultSet rsxx = null; Class.forName("com.mysql.jdbc.Driver"); connectionxx = DriverManager.getConnection(Hostxx, "ifastdem_admin", "P@s$w()rd"); statementxx = connectionx.createStatement(); // String Data = "select negeri, emas, perak, gangsa, (emas + perak + gangsa) AS jumlah from pingat order by emas desc, perak desc, gangsa desc, negeri "; String Dataxx = "select a.*, IF(b.j_emas IS NULL,0,b.j_emas) emas, IF(c.j_perak IS NULL,0,c.j_perak) perak, IF(d.j_gangsa IS NULL,0,d.j_gangsa) + IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa, IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa_2,(IF(b.j_emas IS NULL,0,b.j_emas)+IF(c.j_perak IS NULL,0,c.j_perak)+IF(d.j_gangsa IS NULL,0,d.j_gangsa)+IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2)) AS tot from kod_daerah a LEFT JOIN (SELECT emas,sum(1) AS j_emas FROM keputusan a LEFT JOIN kod_kategori b ON b.idkategori = a.kod_kategori WHERE type = 2 AND emas != '' AND b.kod_sukan='"+uid+"' GROUP BY b.kod_sukan,emas) b ON b.emas = a.idDaerah LEFT JOIN (SELECT perak,sum(1) AS j_perak FROM keputusan a LEFT JOIN kod_kategori b ON b.idkategori = a.kod_kategori WHERE type = 2 AND perak != '' AND b.kod_sukan='"+uid+"' GROUP BY b.kod_sukan,perak) c ON c.perak = a.idDaerah LEFT JOIN (SELECT gangsa,sum(1) AS j_gangsa FROM keputusan a LEFT JOIN kod_kategori b ON b.idkategori = a.kod_kategori WHERE type = 2 AND gangsa != '' AND b.kod_sukan='"+uid+"' GROUP BY b.kod_sukan,gangsa) d ON d.gangsa = a.idDaerah LEFT JOIN (SELECT gangsa_2,sum(1) AS j_gangsa_2 FROM keputusan a LEFT JOIN kod_kategori b ON b.idkategori = a.kod_kategori WHERE type = 2 AND gangsa_2 != '' AND b.kod_sukan='"+uid+"' GROUP BY b.kod_sukan,gangsa_2) e ON e.gangsa_2 = a.idDaerah LEFT JOIN (SELECT emas,sum(1) AS j_emas FROM keputusan a WHERE type = 2 AND emas != '' GROUP BY emas) f ON f.emas = a.idDaerah ORDER BY a.daerah ASC,f.j_emas DESC,c.j_perak DESC,(d.j_gangsa+e.j_gangsa_2) DESC"; // out.print(Dataxx); rsxx = statementxx.executeQuery(Dataxx); while (rsxx.next()) { %> <% } %> <% } %> <% String Hostxxxyy = "jdbc:mysql://localhost:3306/ifastdem_webmsnt"; Connection connectionxxxyy = null; Statement statementxxxyy = null; ResultSet rsxxxyy = null; Class.forName("com.mysql.jdbc.Driver"); connectionxxxyy = DriverManager.getConnection(Hostxxxyy, "ifastdem_admin", "P@s$w()rd"); statementxxxyy = connectionxxxyy.createStatement(); // String Data = "select negeri, emas, perak, gangsa, (emas + perak + gangsa) AS jumlah from pingat order by emas desc, perak desc, gangsa desc, negeri "; String Dataxxxyy = "select a.*, IF(b.j_emas IS NULL,0,b.j_emas) emas, IF(c.j_perak IS NULL,0,c.j_perak) perak, IF(d.j_gangsa IS NULL,0,d.j_gangsa) + IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa, IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa_2,(IF(b.j_emas IS NULL,0,b.j_emas)+IF(c.j_perak IS NULL,0,c.j_perak)+IF(d.j_gangsa IS NULL,0,d.j_gangsa)+IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2)) AS tot from kod_daerah a LEFT JOIN (SELECT emas,sum(1) AS j_emas FROM keputusan WHERE type = 2 AND emas != '' GROUP BY emas) b ON b.emas = a.idDaerah LEFT JOIN (SELECT perak,sum(1) AS j_perak FROM keputusan WHERE type = 2 AND perak != '' GROUP BY perak) c ON c.perak = a.idDaerah LEFT JOIN (SELECT gangsa,sum(1) AS j_gangsa FROM keputusan WHERE type = 2 AND gangsa != '' GROUP BY gangsa) d ON d.gangsa = a.idDaerah LEFT JOIN (SELECT gangsa_2,sum(1) AS j_gangsa_2 FROM keputusan WHERE type = 2 AND gangsa_2 != '' GROUP BY gangsa_2) e ON e.gangsa_2 = a.idDaerah ORDER BY a.daerah ASC,b.j_emas DESC,c.j_perak DESC,(d.j_gangsa+e.j_gangsa_2) DESC"; // out.print(Dataxxx); rsxxxyy = statementxxxyy.executeQuery(Dataxxxyy); while (rsxxxyy.next()) { %> <%} %> <% String Hostxxxy = "jdbc:mysql://localhost:3306/ifastdem_webmsnt"; Connection connectionxxxy = null; Statement statementxxxy = null; ResultSet rsxxxy = null; Class.forName("com.mysql.jdbc.Driver"); connectionxxxy = DriverManager.getConnection(Hostxxxy, "ifastdem_admin", "P@s$w()rd"); statementxxxy = connectionxxxy.createStatement(); // String Data = "select negeri, emas, perak, gangsa, (emas + perak + gangsa) AS jumlah from pingat order by emas desc, perak desc, gangsa desc, negeri "; String Dataxxxy = "select a.*, IF(b.j_emas IS NULL,0,b.j_emas) emas, IF(c.j_perak IS NULL,0,c.j_perak) perak, IF(d.j_gangsa IS NULL,0,d.j_gangsa) + IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa, IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2) gangsa_2,(IF(b.j_emas IS NULL,0,b.j_emas)+IF(c.j_perak IS NULL,0,c.j_perak)+IF(d.j_gangsa IS NULL,0,d.j_gangsa)+IF(e.j_gangsa_2 IS NULL,0,e.j_gangsa_2)) AS tot from kod_daerah a LEFT JOIN (SELECT emas,sum(1) AS j_emas FROM keputusan WHERE type = 2 AND emas != '' GROUP BY emas) b ON b.emas = a.idDaerah LEFT JOIN (SELECT perak,sum(1) AS j_perak FROM keputusan WHERE type = 2 AND perak != '' GROUP BY perak) c ON c.perak = a.idDaerah LEFT JOIN (SELECT gangsa,sum(1) AS j_gangsa FROM keputusan WHERE type = 2 AND gangsa != '' GROUP BY gangsa) d ON d.gangsa = a.idDaerah LEFT JOIN (SELECT gangsa_2,sum(1) AS j_gangsa_2 FROM keputusan WHERE type = 2 AND gangsa_2 != '' GROUP BY gangsa_2) e ON e.gangsa_2 = a.idDaerah ORDER BY a.daerah ASC,b.j_emas DESC,c.j_perak DESC,(d.j_gangsa+e.j_gangsa_2) DESC"; // out.print(Dataxxx); Integer x1 = 0; Integer x2 = 0; Integer x3 = 0; Integer x4 = 0; rsxxxy = statementxxxy.executeQuery(Dataxxxy); while (rsxxxy.next()) { x1 = rsxxxy.getInt("emas")+rsxxxy.getInt("perak")+rsxxxy.getInt("gangsa"); %> <%} %>
Kontinjen :<%=rsxxx.getString("nama")%>
Sukan(E) (P) (G)
<%=rsx.getString("sukan")%><%=rsxx.getString("emas")%> <%=rsxx.getString("perak")%> <%=rsxx.getString("gangsa")%>
Jumlah :<%=rsxxxyy.getString("emas")%> <%=rsxxxyy.getString("perak")%> <%=rsxxxyy.getString("gangsa")%>
<% out.print(x1); %>
<% String a=request.getParameter("a1"); String b=request.getParameter("a2"); String c=request.getParameter("a3"); String d=request.getParameter("a4"); String urlx="jdbc:mysql://localhost:3306/ifastdem_webmsnt"; Connection connx=null; PreparedStatement psx=null; Class.forName("com.mysql.jdbc.Driver").newInstance(); if(a!=null && b!=null && c!=null && d!=null){ try{ connx=DriverManager.getConnection(urlx,"ifastdem_admin","P@s$w()rd"); String queryx="Insert into berita(tarikh,title,filename,details) values(?,?,?,?)"; psx=connx.prepareStatement(queryx); psx.setString(1,a); psx.setString(2,b); psx.setString(3,c); psx.setString(4,d); psx.executeUpdate(); response.sendRedirect("berita.jsp"); }catch(Exception ex){ out.println("Your Connection Failed"+ex); }finally{ psx.close(); connx.close(); } } %>