I have a question for you guys.I'm using count rows on jsp page. Is it possible to count rows of table by "sess.getAttribute"? I have a table "cart" and i have column "id" there, but I want to to count rows depending on the who's loogged on page. I hope you understand. And i put number for example 2 for id and it works, but you know, I want to put there numbers of id depending on the who's loogged on page. This is my code:
try{
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
String mysqlUrl = "jdbc:mysql://localhost:3306/cars?zeroDateTimeBehavior=convertToNull&serverTimezone=UTC";
Connection con = DriverManager.getConnection(mysqlUrl, "root", "root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select count(*) from cart WHERE uid=2");
rs.next();
%>
<div id="box"><p id="number"</p><%=rs.getInt("count(*)")%></div>