<%@ page contentType="text/html; charset=iso-8859-9" language="java" import="java.sql.*"%>
<%
Class.forName("org.gjt.mm.mysql.Driver");
Connection baglanti = DriverManager.getConnection("jdbc:mysql://localhost/aspet?user=root&password=");
String sql = "SELECT * FROM sayac WHERE no='1'";
Statement sorgulama = baglanti.createStatement();
ResultSet veri = sorgulama.executeQuery(sql);
String guncelleme = "UPDATE sayac SET sayac=? WHERE no='1'";
PreparedStatement guncelle = baglanti.prepareStatement(guncelleme);
if ( veri.next() ) {
int deger = veri.getInt("sayac")+1;
guncelle.setInt(1,deger);
guncelle.executeUpdate();
out.print("Sayacın değeri:" + deger);
}
%>