I have a really bad and irritating problem and would love some help.
I have a table which contains:
1) storyratingid - AutoNumber
2) storyrating - Number entered into database by user
3) visitorip - IP of the user who rated the story
4) storyid - ID of the story that was rated
5) storytitle - The title of the story that was rated
Now I'm trying to show a top rated asp page "top.asp" which will show the top rated stories in order of descending ratings, what the average rating is, and how many users rated that story.
So far, I've come up with a way to show stories which have a rating higher than 4 out of 10. Here it is:
<%@ language = vbscript %>
<%
strServerConnection = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ="&server.mapPath("data.mdb")
set con = server.createObject("ADODB.Connection")
con.open(strServerConnection)
sqlString = "Select storytitle, storyid, storyrating from ratingdb Where storyrating > 4"
set rs = con.execute(sqlString)
do while not rs.eof
storyid = rs("storyid")
storytitle = rs("storytitle")
storyrating = rs("storyrating")
%>
<%=storytitle%> - Rating: <%=storyrating%>/10 by "n" visitors
<%
rs.MoveNext
loop
rs.Close
%>
But I can't find a way to make sure that the highest rated is displayed first, and nor can this script show the number of users who voted for that story, represented by "n".
HELP!!!!!!!!!!