Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 1st, 2002, 11:34 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Exclamation Article Discussion: An Article Rating System With ASP

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 .

Reply With Quote
  #2  
Old June 2nd, 2002, 12:49 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 7
Send a message via ICQ to James Yang
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/

Reply With Quote
  #3  
Old June 3rd, 2002, 07:12 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
i keep getting this error any reason why.......

PHP Code:
 Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[
Microsoft][ODBC Driver ManagerData source name not found and no default driver specified
/showcds.aspline 9


Browser Type
:
Mozilla/4.0 (compatibleMSIE 6.0Windows NT 5.0

Page:
GET /showcds.asp 

Time
:
MondayJune 0320027:25:23 PM 


More information
:
Microsoft Support 
__________________
Apache Expert

Reply With Quote
  #4  
Old June 4th, 2002, 12:59 AM
Frank Frank is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 8 Frank User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ASP vs. PHP

Hello myLady.

Is there a possibility to convert this to a PHP-script?

Frank

Reply With Quote
  #5  
Old June 5th, 2002, 10:46 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
mytch is there a way i can change the dns to point the database cause i can't get this script to work

Reply With Quote
  #6  
Old October 15th, 2002, 01:00 PM
awesome261280 awesome261280 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 1 awesome261280 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy helppppp

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.

Reply With Quote
  #7  
Old October 15th, 2002, 07:32 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
showing us the problem code would be a start

Reply With Quote
  #8  
Old December 27th, 2002, 05:23 PM
laridev laridev is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 "&nbsp;" & 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
%>

Reply With Quote
  #9  
Old December 28th, 2002, 12:22 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 7
Send a message via MSN to aspnewbie
laridev, see my comments under the asp forum post

asp_man, are you still needing help or have you figured it out?

Reply With Quote
  #10  
Old January 6th, 2003, 05:30 PM
laridev laridev is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #11  
Old March 31st, 2003, 11:46 AM
zigote zigote is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Atlanta GA
Posts: 73 zigote User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 11 sec
Reputation Power: 7
I'm with Frank,
Can you do this one in PHP, I know mytch can.

But if not I will keep at it...

Reply With Quote
  #12  
Old July 4th, 2003, 06:44 AM
Jeremy Jeremy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Hawaii
Posts: 3 Jeremy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Rating system with a Top 10 ??

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

Reply With Quote
  #13  
Old July 4th, 2003, 01:36 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 7
Send a message via MSN to aspnewbie
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

Reply With Quote
  #14  
Old July 5th, 2003, 06:29 AM
Jeremy Jeremy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Hawaii
Posts: 3 Jeremy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #15  
Old July 5th, 2003, 07:12 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 7
Send a message via MSN to aspnewbie
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.

Reply With Quote
  #16  
Old July 8th, 2003, 11:53 AM
Jeremy Jeremy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Hawaii
Posts: 3 Jeremy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #17  
Old July 9th, 2003, 05:58 PM