Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <html>
- <head>
- <title>Information</title>
- </head>
- <body>
- <%@ page import ="java.sql.*"%>
- <%@ page import ="javax.sql.*"%>
- <%@ page import ="java.util.Random"%>
- <%
- String ID = request.getParameter("id");
- try {
- Class.forName("com.mysql.jdbc.Driver");
- Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ebookshop?useSSL=false&serverTimezone=UTC", "root", "root");
- Statement st = connection.createStatement();
- ResultSet rs;
- String query = "select * from books users where id = '"+ID+"'";
- //PreparedStatement statement = connection.prepareStatement(query);
- rs = st.executeQuery(query);
- while(rs.next())
- {
- if(rs.getInt(1) == Integer.parseInt(ID))
- {%>
- <a href=""<%=rs.getInt(1)%></a> <br/><br/>
- <a href=""><%=rs.getString(2)%></a> <br/><br/>
- <a href=""><%=rs.getString(3)%></a> <br/><br/>
- <a href=""><%=rs.getFloat(4)%></a> <br/><br/>
- <a href=""><%=rs.getInt(5)%></a> <br/><br/>
- <%}
- }
- out.println("Success");
- } catch(Exception e){
- out.println(e.getMessage());
- }
- %>
- <a href="index.html">Home</a>
- </body>
- </html>
Add Comment
Please, Sign In to add comment