MySQL

Moderators: Jonathan
Number of threads: 266
Number of posts: 525

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
retrieve info from dbase using JSP Posted by tyapsing on 23 Jan 2003 at 12:28 AM
i need to display the event from dbase to jsp calender, but the event for current date can't be display unless it is placed at the top of the dbase list. i'm currently using mysql, jdk1.3.1 and tomcat 4.0. The program is written in javascript and saved as .jsp. please help. The complete calendarcan be mail to those interested to help further. Thanks.

ResultSet RS= stmt.executeQuery("select date_format(date,'%M'),date_format(date,'%d'),event,category from cal");
.
.
calendar += "<table width='100%' border='0' cellpadding='2' cellspacing='1'>";
calendar += "<tr>";
if(startday > 0) {
for(empty = 0; empty < startday; empty++) {
calendar += "<td width='" + twidth + "' height='" + theight + "'> </td>";
}
}
for(i = startday; i <= endday; i++) {
if( (i % 7) == 0) {
calendar += "</tr><tr>";
}

//keep highlight info on the current month and day
if( (i - (startday - 1)) == dt && currentmonth == mo && currentyear == year) {
calendar += "<td width='" + twidth + "' height='" + theight + "' bgcolor='" + daybg + "' align='right' valign='top'><font face='" + dayfam + "' size=" + daysize + "><b>";
calendar += "<a href='javascript://' onclick=javascript:open_window('day_schedule.jsp?" + months[mo] + "&" + count + "',500,350,0,1);><font color=" + sdaycol + ">" + count + "</font></a>";

<%

if(RS.next()){

month=RS.getString("date_format(date,'%M')");
date=RS.getString("date_format(date,'%d')");
ev=RS.getString("event");
cat=RS.getString("category");
%>
var col;
if ((months[mo]=="<%=month%>")&&(count=="<%=date%>")) {

calendar += "<table width=100%>";
calendar += "<tr><td>";
calendar += "<font face=Arial size=1 color=#000000><%=ev%></font>";
calendar += "</td></tr>";
calendar += "</table>";


}
<%
}
%>

calendar += "</b></font></td>";

} else {

calendar += "<td width='" + twidth + "' height='" + theight + "' bgcolor='" + daybg + "' align='right' valign='top'><font face='" + dayfam + "' size=" + daysize + ">";
calendar += "<a href='javascript://' onclick=javascript:open_window('day_schedule.jsp?" + months[mo] + "&" + count + "',500,350,0,1);><font color=" + daycol + ">" + count + "</font></a>";

<%

while(RS.next()){

month=RS.getString("date_format(date,'%M')");
date=RS.getString("date_format(date,'%d')");
ev=RS.getString("event");
cat=RS.getString("category");
%>
var col;
if ((months[mo]=="<%=month%>")&&(count=="<%=date%>")){

calendar += "<table width=100%>";
calendar += "<tr><td>";
calendar += "<font face=Arial size=1 color=#000000><%=ev%></font>";
calendar += "</td></tr>";
calendar += "</table>";
}

<%
}
%>

calendar += "</font></td>";
}
count++;
}

calendar += "</tr>";
calendar += "</table>";



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.