|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
An Article Rating System With ASP If you have any questions or comments on this article then please post them here.
You can read the article here . |
|
#2
|
|||
|
|||
|
I just like to comment on that article
Rather than using half and full image for the rating bars which gives "inaccurate" bar image, I found a way to create better looking rating bars. (imo) here it is <table height =7 cellspacing =1 width = thewidth bgcolor = bordercolorgoeshere cellpadding =0> <tr> <td bgcolor = "backgroundcolorgoeshere"> <img src = "bar.gif" height=7 width = "percentage%" </td> </tr></table> here bar.gif is one pixel by one pixel gif image. the color of this pixel will be the color of ur bar.
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
|
#3
|
|||
|
|||
|
i keep getting this error any reason why.......
PHP Code:
__________________
Apache Expert |
|
#4
|
|||
|
|||
|
ASP vs. PHP
Hello myLady.
Is there a possibility to convert this to a PHP-script? Frank |
|
#5
|
|||
|
|||
|
mytch is there a way i can change the dns to point the database cause i can't get this script to work
![]() |
|
#6
|
|||
|
|||
|
hey..can some one pls pls plssss help me ..i have to submit my project in a week and im doing the rating thing for it. and its working fine that is the ratings are going in the rating table but when it gets to the showcd part i donno why it gives this error on the call function line.
Rated: Provider error '80020005' Type mismatch. |
|
#7
|
|||
|
|||
|
showing us the problem code would be a start
|
|
#8
|
|||
|
|||
|
Hi
I am getting an error on line 43 I cant figure it out....Can you help me.... <% dim conn, rs, strSQL, strConnect, action action = Request.QueryString("action") set conn = Server.CreateObject("ADODB.Connection") set rs = Server.CreateObject("ADODB.Recordset") strConnect = "PROVIDER=SQLOLEDB;UID=sa;PWD=gilgamesh;Data Source=mhsnet_sql;Initial Catalog=Intranet;" strSQL = "Select * from question order by question;" conn.Open strConnect rs.CursorLocation = adUseClient rs.Open strSQL,conn,adOpenForwardOnly,adLockReadOnly %> while not rs.EOF %> <font face="Verdana" size="2" color="black"> <h2><%=rs.Fields(1).Value%></h2> Rated: <%=ShowRating(rs.Fields(0).Value)%><br><br> <b>Question:</b> <%=rs.Fields(2).Value%><br> <b>Summary:</b> <%=rs.Fields(3).Value%><br> <b>Category:</b> <%=FormatCurrency(rs.Fields(4).Value, 2)%><br> </font> <br> <form name="frmRate<%=rs.Fields(0).value%>" action="rate.asp" method="post"> <input type="hidden" name="quesId" value="<%=rs.Fields(0).value%>"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="black"> <font face="Verdana" size="1" color="white"> <% for i = 1 to 5 Response.Write " " & i & " <input name='rating' type='radio' value='" & i & "'> " next %> </font> <input type="submit" value="Rate It!"> </td> </tr> </table> </form> <hr size="1" color="#08496B" NOSHADE> <% rs.MoveNext wend function ShowRating(quesId) const MIN_RATINGS_BEFORE_SHOW = 3 dim rs1 dim avgRating dim avgWhole dim decPart dim decCalc dim finalRating dim altText set rs1 = Server.CreateObject("ADODB.Recordset") rs1.ActiveConnection = Server.CreateObject("ADODB.Connection") rs1.Open "SELECT SUM(rating), COUNT(*) FROM rating WHERE quesId = " & quesId if rs1.Fields(1) < MIN_RATINGS_BEFORE_SHOW then 'No ratings for this Ques just yet Response.Write "[Ques not rated yet]" else 'This Ques has ratings, let's display the average avgRating = rs1.Fields(0).Value / rs1.Fields(1).Value if Instr(1, CStr(avgRating), ".") > 0 then 'The average rating is a decimal, we need to either 'round the value up/down avgWhole = Left(CStr(avgRating), Instr(1, CStr(avgRating), ".")-1) decPart = Mid(CStr(avgRating), Instr(1, CStr(avgRating), ".")+1, 2) if decPart <> "" then 'Work out whether or not we have to round this 'rating up or down if CInt(decPart) >= 5 then decCalc = .5 else decCalc = 0 end if finalRating = CInt(avgWhole) + CCur(decCalc) else finalRating = avgRating end if else finalRating = avgRating end if 'Setup the alt text for the images altText = "Average visitor rating of " & finalRating & " out of 5" for i = 1 to CInt(finalRating) Response.Write "<img alt='" & altText & "' src='rating_on.gif'>" next if CInt(finalRating) <> finalRating then 'This Question has a .5 rating, such as 5.5 Response.Write "<img alt='" & altText & "' src='rating_half.gif'>" for i = CInt(finalRating)+2 to 5 Response.Write "<img alt='" & altText & "' src='rating_off.gif'>" next else for i = CInt(finalRating)+1 to 5 Response.Write "<img alt='" & altText & "' src='rating_off.gif'>" next end if end if end function %> |
|
#9
|
|||
|
|||
|
laridev, see my comments under the asp forum post
asp_man, are you still needing help or have you figured it out? |
|
#10
|
|||
|
|||
|
Has anyone played around with this script enough to know if you can display at the bottom rather than on every rating item the Rate it button?
Let me know and of course if you can share it here... thanks |
|
#11
|
|||
|
|||
|
I'm with Frank,
Can you do this one in PHP, I know mytch can. But if not I will keep at it... |
|
#12
|
|||
|
|||
|
Have an excellent working rating system, completely customized with a basis from the Rating System Article by Annette.
Now I want to add a Top 10 list of items that have been rated, but I don't seem to get the proper select orders from tblItems and tblRating. Anyone a clue how to add a Top 10?? Check the ratingsystem at: Da Surf Girl |
|
#13
|
|||
|
|||
|
Can't you just do a
Select Top 10 a.RatingID, a.Rating, b.Title, b.ArticleID, etc from Ratings a, Articles b, where a.ArticleID = b.ArticleID Order by a.Rating |
|
#14
|
|||
|
|||
|
Rating system with a Top 10 ??
Looks already better, but I'm missing 'something' however ("Object required"), have the following code:
Dim strGetSQL, rsGet, i Set rsGet = Server.CreateObject ("ADODB.Recordset") OpenConnection strGetSQL = "SELECT TOP 10 a.picID, a.rating, b.title, b.name, b.picID FROM tblRating a, tblPhotos b WHERE a.picID = b.picID ORDER BY a.rating DESC" rsGet.Open strGetSQL, objConn While NOT rs.EOF %> <tr> <td width="70%" align="left"> <%= rsGet.Fields(2).Value %> - <%= rsGet.Fields(1).Value %> </td> </tr> <% rsGet.MoveNext Wend rsGet.Close Set rsGet = Nothing CloseConnection I assume I also need to include something like "SUM(rating)/COUNT(*)" in order to get an average? Jeremy |
|
#15
|
|||
|
|||
|
You're probably getting the object required error because you're referring to two different recordsets (probably a typo?)
You define your recordset as rsget but in the loop you refer to it as rs. Try naming them the same thing. Sorry, I didn't realize that the average isn't in the table (haven't reread the article in a while.) hmmm, in that case, you might need a nested select statement. Let me think about it. |
|
#16
|
|||
|
|||
|
Top 10 Photo Rating
Fixed the problem, with a quickresponding Innerjoin selection, thanks to a SQL-server bible:
"SELECT TOP 10 Title AS Name, AVG(rating) AS Rated FROM tblItem INNER JOIN tblRatings ON tblItem.picID = tblRatings.picID GROUP BY tblItem.title, tblRatings.picID ORDER BY AVG(rating) DESC" Result is the top 10 list, which can be nicely displayed in a table. See: Da Surf Girl Top 10 Might be of use to others as well, and an addition to the ratingsystem. Jeremy |
|
#17
|