Division

This is a discussion on "Division" within the Databases section. This forum, and the thread "Division are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 26th, 2008, 17:46
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,410
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Division

I am working on a system that rates articles.

It has a colum called Rating, and one called Times Rated.

Rating is the total of all the ratings put together.

So if an article is rated with the scores: 4 4 1 2 4
Rating = 15

Times Rated is the number of times it has been rated, so using the example above that would be 5.

I can then work out the actual rating by doing Rating/Times Rated = 3.

If I wanted to rank articles using this, how would I do it? Can I literally do:
Code: Select all
$sql = mysql_query("SELECT * FROM content  ORDER BY rated/times_rated DESC LIMIT 0, 5");
Or is there another way?

Cheers,

Jack
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Reply

Tags
mysql, query

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Division alignment problem Craigj1303 Web Page Design 0 Apr 3rd, 2008 14:29
Image bAckground of a division ahm531 Web Page Design 3 Aug 31st, 2006 15:54


All times are GMT. The time now is 22:09.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved