Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Image rating help
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Image rating help

 Post Reply Post Reply
Author
Nischint View Drop Down
Groupie
Groupie
Avatar

Joined: 26 August 2002
Location: India
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nischint Quote  Post ReplyReply Direct Link To This Post Topic: Image rating help
    Posted: 17 June 2003 at 10:15am

I'm building an image rating app and am having some trouble. I have one db, with two tables, "images" and "ratings".

images Fields - imgid, imgtitle, imglink
ratings Fields - rateid, imgid, imgtitle, imgrating, visitorip, ratedate

The image are shown in random order (using ADO), so the sql is:

sql= "select imgid, imgtitle, imglink from images order by imgid desc"
rs.Open sql, cn, 3, adCmdText

Dim intRnd
Randomize Timer
intRnd = (Int(RND * rs.RecordCount))
rs.Move intRnd

The user rates the image, and then submits a form, which brings up another page, with a new random image.

Although this gives me a random image every time, sometimes the images are repeated. Now how do I make sure that a user gets a different random image every time?

In the ratings, the sql inserts the IP of the user who rated the image. Should I use that or cookies? If I use the ip method, how do I interact with the two tables?

Another thing. Once an image is displayed, how do I check the ratings table to find out if the image has been rated before, and what the average rating is, and display that result?

A better idiot

Jam Like That
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2003 at 10:49am
What database type are you using? If you use SQL Server it does the joing automatically for you so you should be able to use a q like:
select imgid, imgtitle, imgling from images, ratings where ratings.visitorip <> & ncVisIP
If you use access you might have to do an inner join on the ratings table.
Back to Top
Nischint View Drop Down
Groupie
Groupie
Avatar

Joined: 26 August 2002
Location: India
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nischint Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2003 at 11:17am

I am using Access 2000, and i've already made a query that joins all the results:

SELECT images.imgid, images.imgtitle, images.imglink, ratings.rateid, ratings.imgip, ratings.imgrating
FROM images INNER JOIN ratings ON images.imgid = ratings.imgid;


From here, how do I go??

A better idiot

Jam Like That
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.