%@ page import="java.sql.*" %>
Registrinumber |
Mark |
<%
Class.forName("org.gjt.mm.mysql.Driver");
Connection cn=DriverManager.getConnection(
"jdbc:mysql://greeny.cs.tlu.ee/if14_jaagup_a", "if14", "ifikas2014");
Statement st=cn.createStatement();
String sorttulp="mark";
if(request.getParameter("sort")!=null &&
request.getParameter("sort").equals("regnr")){
sorttulp="regnr";
}
ResultSet rs=st.executeQuery("SELECT regnr, mark FROM autod ORDER BY "+sorttulp);
while(rs.next()){
out.println(""+rs.getString("regnr")+" | "+
rs.getString("mark")+" |
");
}
%>