tispe
04-28-2008, 11:22 AM
I have this assignment thats pretty much done, but im missing one thing...the output needs to go into tables
http://web.njit.edu/~cp76/IT202/Assignment10/assignment10.html
so right there when you select some options, it runs this code:
<%@ page import="java.sql.*" %>
<%
Connection conn=null;
try
{ Class.forName ("org.gjt.mm.mysql.Driver").newInstance();
conn
= DriverManager.getConnection
("jdbc:mysql://sql2.njit.edu/cp76_proj", "cp76_proj", "ouFmfJKl");
}
catch (Exception exc)
{ out.println(exc.toString() + "<br>"); }
out.println ("Database Connected.");
Statement stm = conn.createStatement();
String s = request.getParameter("D");
out.println ("<br>Select SQL: " + s + "<br><br>") ;
ResultSet x = stm.executeQuery (s) ;
String n;
String a;
while ( x.next ( ) )
{
n = x.getString( "name" ) ;
a = x.getString( "age" ) ;
out.println ( "Name: " + n ) ;
out.println ( "<br>Age: " + a ) ;
out.println ("<br><img src=" + n + " height=300 width=300 /><br><br>");
}
%>
The images though should be put into a table though i guess. I think name and age in one cell and the image in another cell. my guess as to where to start the table tag is right outside the while loop at the end and then put the <td> on the printlines?
http://web.njit.edu/~cp76/IT202/Assignment10/assignment10.html
so right there when you select some options, it runs this code:
<%@ page import="java.sql.*" %>
<%
Connection conn=null;
try
{ Class.forName ("org.gjt.mm.mysql.Driver").newInstance();
conn
= DriverManager.getConnection
("jdbc:mysql://sql2.njit.edu/cp76_proj", "cp76_proj", "ouFmfJKl");
}
catch (Exception exc)
{ out.println(exc.toString() + "<br>"); }
out.println ("Database Connected.");
Statement stm = conn.createStatement();
String s = request.getParameter("D");
out.println ("<br>Select SQL: " + s + "<br><br>") ;
ResultSet x = stm.executeQuery (s) ;
String n;
String a;
while ( x.next ( ) )
{
n = x.getString( "name" ) ;
a = x.getString( "age" ) ;
out.println ( "Name: " + n ) ;
out.println ( "<br>Age: " + a ) ;
out.println ("<br><img src=" + n + " height=300 width=300 /><br><br>");
}
%>
The images though should be put into a table though i guess. I think name and age in one cell and the image in another cell. my guess as to where to start the table tag is right outside the while loop at the end and then put the <td> on the printlines?