Advertisement
Guest User

Untitled

a guest
Dec 28th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. <table border="1" width="30%" height="30%">
  2. <th><font color='#D18603'>ActivityID</font>
  3. <th><font color='#D18603'>Type</font></th>
  4. <th><font color='#D18603'>Description</font></th>
  5. <th><font color='#D18603'>City</font></th>
  6. <th><font color='#D18603'>Location</font></th>
  7. <th><font color='#D18603'>Date</font></th>
  8. <th><font color='#D18603'>Price</font></th>
  9. <th><font color='#D18603'>Buy</font>
  10.  
  11.  
  12.  
  13.  
  14.  
  15. <%
  16. Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
  17. Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/users", "users", "123");
  18.  
  19. Statement st = con.createStatement();
  20. ResultSet rs;
  21. rs = st.executeQuery("select * from activities where type='müzik'");
  22. while (rs.next()) {
  23.  
  24. out.println("<tr>");
  25. out.println("<td>" + rs.getString("id")+"</td>");
  26. out.println("<td>" + rs.getString("type")+ "</td>");
  27. out.println("<td>" + rs.getString("description")+ "</td>");
  28. out.println("<td>" + rs.getString("city") + "</td>");
  29. out.println("<td>" + rs.getString("location")+ "</td>");
  30. out.println("<td>" + rs.getString("date") + "</td>");
  31. out.println("<td>" + rs.getString("price") + "</td>");
  32. out.println("<td><b><form action='reservations.jsp'><select name='buy'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option></select><input type='submit' value='Submit'></form></b>");
  33. out.println("</tr>");
  34.  
  35. }
  36. st.close();
  37.  
  38. %>
  39.  
  40. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  41. <%@ page import ="java.sql.*" %>
  42. <%
  43.  
  44. String username = (String) request.getSession().getAttribute("username");
  45. Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
  46. Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/users", "users", "123");
  47.  
  48. String sorgu = "INSERT INTO reservation(id,username,buy) VALUES ('" + request.getParameter("id") + "', '" + username + "','" + request.getParameter("buy") + "') ";
  49.  
  50. java.sql.Statement st = con.createStatement();
  51.  
  52. int rowNum = st.executeUpdate(sorgu);
  53. response.sendRedirect("paypal.html");
  54. st.close();
  55. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement