jsp中 readtag 0 未读 1已读
message.jsp
<a href="../advertiser/message_detail.jsp?id=<%=id%>"> <%=title %>
<%
if(readtag==0)
{
%>
<font color= "#ff0000 ">(未读)</font>
<%
}
%>
message_detail.jsp
int readtag= rs.getInt("readtag");
if(readtag==0){
db.executeUpdate("update saysomething set readtag=1 where id="+id);
}
在Online_view.asp(显示用户信息页)
strSql= "select * from (表名).. ...(查询数据库部分加入下面代码)
if not rs.eof then
rs( "readTag ")=1
rs.update
end if
作用就是当读某ID后便向数据库的readtag写入值“1”
然后在Register_view.asp(显示已经注册的用户列表页)
在你想要显示是否已读标准的地方加入如下代码:
<%
exec= "select readtag from Online where "
if rs( "readTag ")=0 then
response.write " <font color= '#ff0000 '> " & "news "& " </font> "
else
response.write( " ")
end if
作用是正如楼上说的,1代表已读,0代表未读
未读的记录就显示红色的“news”标志
已读的记录留空
%>