|
|
|
|
|
To Log on as a System Administrator: |
username: |
sysAdmin@synergyknowledgesystems.co.uk |
|
|
password: |
demo |
|
|
|
|
|
To Log on as the Sales department Team Leader: |
username: |
tracy@synergyknowledgesystems.co.uk |
|
|
password: |
tracy |
|
|
|
|
|
To Log on as a Sales Department User: |
username: |
joanne@synergyknowledgesystems.co.uk |
|
password: |
joanne |
|
|
|
|
|
|
<%
/* various variable declarations */
Connection con = null;
Statement st;
String sql;
ResultSet rs;
ResultSetMetaData rsmd;
try {
/* load JDBC driver for MySQL database */
Class.forName("com.mysql.jdbc.Driver").newInstance();
/* make a connection to the database */
con = DriverManager.getConnection("jdbc:mysql://localhost/synergyk_holiday?user=synergyk_cmedine&password=calume");
/* create and execute a statement */
st=con.createStatement();
sql=("SELECT * FROM infoPortal order by articleTime desc");
st.executeQuery(sql);
/* get the results and metadata */
rs=st.getResultSet();
rsmd=rs.getMetaData();
//get number of columns
int numcols=rsmd.getColumnCount();
int i;
%>
<%
int iRowCount = 1;
while (rs.next()){
/*Use the mod operator to get the value for the table row background colour*/
int iCountResult = iRowCount%2;
String sBackColour ="";
if(+iCountResult == 0 ){
sBackColour ="#BAD1ED";
}else{
sBackColour ="#CDDDF2";
}//end if
String sTitle = (String)rs.getObject(2);
String sHeading = (String)rs.getObject(3);
String sInfoContent = (String)rs.getObject(4);
sTitle = convertFromDB(sTitle);
sHeading = convertFromDB(sHeading);
sInfoContent = convertFromDB(sInfoContent);
String sPublish = (String)rs.getObject(5);
if(sPublish.equals("yes")){
%>
|
<%=rs.getObject(2)%>
<%=rs.getObject(3)%>
|
<%
iRowCount++;
}//end if
}//end while%>
|
|
<%
con.close();
/* error handling */
} catch (Exception e) {
out.println("Error in JDBC database access ");
out.println(""+e+" ");
} ;
%>
|