Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : cekbuah
- Created on : Jul 17, 2012, 12:10:00 PM
- Author : Aldo
- --%>
- <%@page import="java.sql.*" %>
- <%
- String nama_buah="";
- nama_buah=request.getParameter("txtbuah").toString();
- if(nama_buah==null){
- out.print("false");
- }else{
- String connectionURL = "jdbc:mysql://localhost:3306/webkelasmalam";
- String user_db = "root";
- String pwd_db = "";
- Class.forName("com.mysql.jdbc.Driver");
- Connection connection = DriverManager.getConnection(connectionURL,user_db,pwd_db);
- Statement stm = connection.createStatement();
- String sql="SELECT nama_buah FROM buah WHERE nama_buah='"+nama_buah+"'";
- ResultSet rs = stm.executeQuery(sql);
- if (rs.next()){
- out.print("false");
- }else{
- out.print("true");
- }
- }
- %>
Advertisement
Add Comment
Please, Sign In to add comment