Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- String leksaker = "Leksaker";
- try{
- Class.forName("com.mysql.jdbc.Driver");
- String url = "jdbc:mysql://localhost:3306/lekrea";
- Connection conn = DriverManager.getConnection(url,"root","root");
- Statement str = conn.createStatement();
- ResultSet rs = str.executeQuery("SELECT id, name,catagory ,brand, url, image, saleprice FROM product WHERE catagory '"+leksaker+"'");
- String id = null;
- String name = null;
- String catagory = null;
- String brand = null;
- String image = null;
- String saleprice = null;
- int count = 0;
- String[] products = null;
- while(rs.next()){
- products = { "Dennis", "Grace", "Bjarne", "James" };
- name = rs.getString("name");
- catagory = rs.getString("catagory");
- brand = rs.getString("brand");
- image = rs.getString("image");
- saleprice = rs.getString("saleprice");
- count++;
- }
- }catch (Exception e) {
- System.err.println("Got an exception! ");
- System.err.println(e.getMessage());
- }
- %>
Add Comment
Please, Sign In to add comment