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: 588 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
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: 17
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
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 403 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 25 sec
Reputation Power: 17
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
Registered User
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
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 403 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 25 sec
Reputation Power: 17
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
Registered User
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
Registered User
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: 17
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
Registered User
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: 17
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
Registered User
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: 17
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
Registered User
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: 17
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
Registered User
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
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: 17
Send a message via MSN to aspnewbie
cool. congrats.

Reply With Quote
  #18  
Old October 28th, 2003, 01:39 AM
mzeb mzeb is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 6 mzeb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry where is the code?

Dear Friends!

I need the total code of that Rating script! can u please tell m e from where i can download the zip file of it???

Regards

Reply With Quote
  #19  
Old October 28th, 2003, 02:00 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: 17
mzeb, did you try looking at the Conclusion page, under that there is a "Support Material" file.

http://www.devarticles.com/art/1/141/5

Is this the one you where talking about?

Reply With Quote
  #20  
Old July 7th, 2004, 06:05 PM
dancrocker dancrocker is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 dancrocker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question I cant find the supporting stuff anywhere!!!

Look, i know it sounds daft since everyone else seems to have found it OK, but where is this supporting code i need???

I think someone may have deleted it. It tells me to go to the bottom of the page but it simply isn't there!!! There is NOTHING called support material ANYWHERE on the page!!!

PLEASE HELP............ I'M LOST!!

Reply With Quote
  #21  
Old July 7th, 2004, 11:36 PM
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: 17
seems the files have been removed for some reason, I no longer see the link to the files either.

Reply With Quote
  #22  
Old October 19th, 2004, 08:40 AM
carrzkiss carrzkiss is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 carrzkiss User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 sec
Reputation Power: 0
there is no files available for this article.
I cannot even get the code to work.
what is the deal with whom ever deleting it,
but yet allowing the text to still show on the page
Stating that it is avialable?

Cannot someone please send me the files?
at delphian @ carrz-fox-fire.com // Broken to stop Spammers the " - " dashes are including in domain.

Thank YOu

Carrzkiss

p.s.
Shot even this Posting Page here is messed up ?? What is up with that ??

Reply With Quote
  #23  
Old October 19th, 2004, 12:18 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 330 Viper_SB User rank is Private First Class (20 - 50 Reputation Level)Viper_SB User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 5 h 3 sec
Reputation Power: 15
This article was posted in 2002 that would be why stuff isn't complete. But I just looked through the article and it seems all the code is there? What exactly are you missing?

Reply With Quote
  #24  
Old October 20th, 2004, 05:41 AM
netytan's Avatar
netytan netytan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Knighton, UK
Posts: 29 netytan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 7 m 44 sec
Reputation Power: 0
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
If you'd like to use this rating system in your own ASP applications, then make sure you download the support material for this file, which you can do at the bottom of this page


Theres the last paragraph in the the conclusion... if you don't actually read what it says its pretty tempting to click on the blue comercial link . Unfortunatly I couldn't see the link to download the support files as the author directed.

Like VB said though, its a pretty old article so that probably explains the missing link.

Oh, while I remember, here's a function I wrote to calculate the size of two images in a percentageBar ala Googles groups: http://groups.google.com/groups?group=comp&hl=en pages.

Code:
#!/usr/bin/env python

"""
"""

def percentBar(votes, total, length):
    
    #Takes the number of votes for this bar, the 'total' number of votes and
    #the length of the bar and calculates the size of this bar to be drawn.
    
    positiveSize = int((votes / total) * length)

    #Returns a Tuple containing the actual percentage of votes and the length
    #(in pixels) of the two parts; if you're only interested in the positive
    #side of the bar then ignore the third value in this Tuple.

    return ((votes / total) * 100, positiveSize, length - positiveSize)

print percentBar(50.0, 100.0, 100)


It's written in Python as some may have guessed, but you should be able to see the idea. Its pretty much the same as dicussed in the article except that this function calculats the size of the two images used in the bar (which can vary length).

Take care,

Mark.

Reply With Quote
  #25  
Old November 17th, 2004, 08:36 AM
userOne userOne is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 4 userOne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 33 sec
Reputation Power: 0
Like to install 5-star rating system w/ existing shopping cart

Hi Dev'ers,
This is my first post & project as a member here... newbie rating Hey nice collection of smilies too...

OK, down to business... I'd like to develop the 5-star rating system for products already in a shopping cart that works w/ paypal:
http://bearrivernet.net/i-pos/
Internet Pay Online Store is a free application and that databse is already built... so I think I can just add the ratings table to the database and be up and running... sounds easy unless your a newbie like me. This will be a great project for me to actually get under the hood of database design.

I'm not sure where and how exactly, I'll need to incorporate the ratings code... if anyone thinks they have a general idea, I could use any insights at all.

Is there anyone that still visits the forums that has a sample of this application up and running, post a link if you do?

It would be great if the site could restore a link to the support materials mentioned... Tried to contact the author Annette Tennison... email returned address unkown
Ty

Reply With Quote
  #26  
Old November 18th, 2004, 08:28 AM
userOne userOne is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 4 userOne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 33 sec
Reputation Power: 0
5-star ratings...

Anybody considering tackling this project...
Go through the articles pages, copy paste to your favorite editor, and comment out all the narrative... then you'll still have some great code to start out with, plus the tutorial what-does-what comments to study.
I started doing that with the first couple of pages, then realized my version, is going to be totally customized...I'm combining this application w/ another, so my connection strings and the like are already in place. Now I need to figure out where and how I want the ratings to appear... they'll be broken down into categories... with not all of them showing at one time, I hope.

If I get mine working I'll post a link to it here then.
Thanks!
Ty

Reply With Quote
  #27  
Old November 20th, 2004, 04:49 PM
userOne userOne is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 4 userOne User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 33 sec
Reputation Power: 0
Anybody have the original support material...Help

I copy pasted all the pages and got my DSN hooked up on my hosting server...
So far nothing but errors, if anyone has the original support materials saved anywhere please post a link for them here.
Is there a missing closing %> at the very end of the rate.asp page as shown in the article or isn't there supposed to be one for some reason? I can't seem to sort out the last bit of the rate.asp page...
Plus where they show ... on the rate.asp page towards the end is the dot dot dot part of the code?
I do have my app showing the cd's , getting some errors at the end of the page though.

Here's links to my pages if anyone cares to take a look:
http://godiscgolf.com/dev/showItems.asp
http://godiscgolf.com/dev/rate.asp

Anybody who hasn't checked out daSurf.com they have a super example of the system in place there.... I'm hoping to maybe here from Jeremy for some help.

Thanks ...
ty

PS: if I can get mine working I'll make it available as a .zip support material download from my webhost.

Reply With Quote
  #28  
Old January 13th, 2005, 07:51 AM
gobez gobez is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 gobez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have spent the last day and a half trying to get this to work without success.

Does anyone have a copy of the showCds.asp and rate.asp pages?

Cheers

gobez

Reply With Quote
  #29  
Old January 24th, 2005, 01:13 PM
DmBlazeDmB DmBlazeDmB is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 DmBlazeDmB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 sec
Reputation Power: 0
Not working

I have two problems I think they are easy to fix but i don't no how?

First problem is In de tutorial they are using an Function for displaying the ratings
but i don't know how to use that function and so my page doesn't show any ratings ?

Second problem the variables cdId , Rating doesn't exist in the page Rate.asp there for
my rating results are not correct. Now I use static variables for checking if the other code worked
and it worked So if somebody know have to get those 2 variable to rate.asp


Here my code (thnx for helping in advance)

<table width="99%" align=center border=0>

<% dim sql ,rs


sql = "SELECT * FROM cds ORDER BY title ASC"
set rs = session("db").execute(sql)
while not rs.EOF

%>

<h2><%=rs.Fields(1).Value%></h2>
<b>Summary:</b> <%=rs.Fields(2).Value%><br>
</font>
<br>
<form name="frmRate<%=rs.Fields(0).value%>" action="rate.asp">
<input type="hidden" name="cdId" 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">
<% dim i
for i = 1 to 10
Response.Write "&nbsp;" & i & " <input name='rating' type='radio' value='1'> "
next
%>
</font>
<input type="submit" value="Rate It!">
</td>
</tr>
</table>
</form>
<hr size="1" color="#08496B" NOSHADE>
<%
rs.MoveNext
wend

function ShowRating(cdId)

const MIN_RATINGS_BEFORE_SHOW = 1

dim rs1
dim avgRating
dim avgWhole
dim decPart
dim decCalc
dim finalRating
dim altText
set session("db") = Server.CreateObject("ADODB.Connection")
session("db").open "DRIVER={MySQL};SERVER=mysq*.**;DATABASE=****;UID=* ****;PWD=****;"

sql= "SELECT SUM(rating), COUNT(*) FROM rating WHERE cdId = " & cdId
set rs1 = session("db").execute(sql)

if rs1.Fields(1) < MIN_RATINGS_BEFORE_SHOW then
Response.Write "[CD not rated yet]"
else

avgRating = rs1.Fields(0).Value / rs1.Fields(1).Value




if Instr(1, CStr(avgRating), ".") > 0 then
avgWhole = Left(CStr(avgRating), Instr(1, CStr(avgRating), ".")-1)
decPart = Mid(CStr(avgRating), Instr(1, CStr(avgRating), ".")+1, 2)

if decPart <> "" then

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

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

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
  #30  
Old February 25th, 2005, 04:42 AM
singh_aashish singh_aashish is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 singh_aashish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 42 sec
Reputation Power: 0
Quote:
Originally Posted by mytch
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 .


I THINK THERE IS AN LOGICAL ERROR AT THE FOLLOWING LINE
for i = 1 to CInt(finalRating)

ACTUALLY I M USING IT AS A PART OF MY APPLICATION AND THE ERROR I M THINKING IS THAT WHEN finalRating VARIABLE HAS A VALUE SAY 3.5 CInt(finalRating) WILL RETURN 4 INSTEAD OF 3 CAUSING THE FOR LOOP TO ITERATE ONE MORE EXTRA TIME. THE COMPLE CODE IS SEND TO U AS AN ATTACHMENT.
PLZ GET TO ME SOOON AS I M USING THIS IN MY APPLICAITON TO BE REALISED ON TUESDAY 1/3/2005.

WITH REGARDS,

AASHISH SINGH
Attached Files
File Type: txt RATING CODE.TXT (2.7 KB, 894 views)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Discussion: An Article Rating System With ASP


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap