Right now the page I'm working one displays all the information in the "Info" table in a table format. The comment field displays an image if a comment has been entered and no image if there is no comment. When the user clicks on the image it links to the original form (another page) and displays the whole form with the comment.
Now what I need to do is remove or clear the image from the table once the comment has been viewed by a user.
A comment can be viewed by many users. And a given user can view many comments. So I created a junction table (called ViewedComments) between Info and Users tables.
ViewedComments
userID (autonumber)
UID (text)
Users
userID (autonumber)
password (text)
.
.
.
Info
ID (autonumber)
UID (text)
.
.
.
.
comments (text)
I have a few questons. First can I use the UID number (from the Info table) to 'check' for a comment. Because a UID can exist even if there is no comment entered but it's the only thing that is unique in this table. And the second is with my query - right now it doesn't do anything. And last I know I have to ad an entry to the ViewedComments table after a given message is viewed by a given user...but I'm not exactly sure how.
This is my code now:
strConnect2 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\inetpub\
Dim asql, rsusers
asql = "select * from Users"
set rsusers = server.createobject("adodb.recordset"
rsusers.open asql, strConnect2, 3
currentUser = rsuser("userID"
//rs is the recordset to the "Info" table
currentMsg = rs("UID"
'Creating the recordset to the ViewedComments table
strConnect3 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\inetpub\Dim rsvc, sql3
sql3 = "SELECT * FROM ViewedComments WHERE userID = '& currentUser &' AND UID = '& currentMsg &' "
set rsvc = server.createobject("adodb.recordset"
rsvc.open sql3, strConnect3, 3
.
.
.
.
<td align=center><font face="Arial, Helvetica, sans-serif" size="1">
<%
if rs("comments" <> "" Then
If rsvc.EOF Then
response.write "<a href='edit.asp?num=" & rs("id" & " '><img src='images/letter.gif' width='20' height='20' border=0></a>"
//I know I should
End IF
Else
response.write " "
End If
.
.
.
.
</td>
</tr>
<%
if row_color = "#e1f5ff" then
row_color = "#ffffff"
else
row_color = "#e1f5ff"
end if
rs.movenext
Loop
rslogin.close
set rslogin = nothing
rsvc.close
set rsvc = nothing
I get no errors but it doesn't do anything. It just displays the info as before.
Any suggestions, ideas, thoughts would be appreciated.
Thanks.
Now what I need to do is remove or clear the image from the table once the comment has been viewed by a user.
A comment can be viewed by many users. And a given user can view many comments. So I created a junction table (called ViewedComments) between Info and Users tables.
ViewedComments
userID (autonumber)
UID (text)
Users
userID (autonumber)
password (text)
.
.
.
Info
ID (autonumber)
UID (text)
.
.
.
.
comments (text)
I have a few questons. First can I use the UID number (from the Info table) to 'check' for a comment. Because a UID can exist even if there is no comment entered but it's the only thing that is unique in this table. And the second is with my query - right now it doesn't do anything. And last I know I have to ad an entry to the ViewedComments table after a given message is viewed by a given user...but I'm not exactly sure how.
This is my code now:
strConnect2 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\inetpub\
Dim asql, rsusers
asql = "select * from Users"
set rsusers = server.createobject("adodb.recordset"
rsusers.open asql, strConnect2, 3
currentUser = rsuser("userID"
//rs is the recordset to the "Info" table
currentMsg = rs("UID"
'Creating the recordset to the ViewedComments table
strConnect3 = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\inetpub\Dim rsvc, sql3
sql3 = "SELECT * FROM ViewedComments WHERE userID = '& currentUser &' AND UID = '& currentMsg &' "
set rsvc = server.createobject("adodb.recordset"
rsvc.open sql3, strConnect3, 3
.
.
.
.
<td align=center><font face="Arial, Helvetica, sans-serif" size="1">
<%
if rs("comments" <> "" Then
If rsvc.EOF Then
response.write "<a href='edit.asp?num=" & rs("id" & " '><img src='images/letter.gif' width='20' height='20' border=0></a>"
//I know I should
End IF
Else
response.write " "
End If
.
.
.
.
</td>
</tr>
<%
if row_color = "#e1f5ff" then
row_color = "#ffffff"
else
row_color = "#e1f5ff"
end if
rs.movenext
Loop
rslogin.close
set rslogin = nothing
rsvc.close
set rsvc = nothing
I get no errors but it doesn't do anything. It just displays the info as before.
Any suggestions, ideas, thoughts would be appreciated.
Thanks.