Page 1 of 1

simple rating sytem

Posted: Mon Jul 09, 2012 11:08 am
by mhakd14
How can we use one and 0 only in ranking system ?

Also how we can build a star system like in Gmail ?

Thank you.

Re: simple rating sytem

Posted: Mon Jul 09, 2012 12:06 pm
by Temor
mhakd14 wrote:how can we use one and 0 only in ranking sysytem.
What?
mhakd14 wrote: And also how we can build a star system like in g mail
I'm guessing you're asking about a star rating system? Considering the title. If so:
You could post 5 ( or however many ) stars and give them a value when clicked, for example 1-5.
Star 1 = 1, Star 2 = 2, and so on.
You would then count each vote as well as the value of each vote and then do some basic math. Divide total value of votes with total count of votes.
Example: 257 Points / 150 votes = 1.7 average. This means we should highlight one full and seven tenth of a star, or just round it up and show two full stars.

The principles behind this is really simple. And there are tonnes of tutorials on how to create a 5-star rating system online.

If you're wondering about this:
Image
Clicking that star sets a boolean value in a database. Click it once for 1 ( true or on ) and again for 0 ( false or off ). Then a check is made to see if that item is starred ( if the Star is set to 1 ). Simple as that.
mhakd14 wrote: thank you
You're welcome!

Re: simple rating sytem

Posted: Mon Jul 09, 2012 3:11 pm
by mhakd14
Yes I mean the Gmail thing not the 5 star rating System. Temor just explain that Gmail thing bit more or please guide me for a good tutorial.

I am new to coding that's why.

Re: simple rating sytem

Posted: Mon Jul 09, 2012 3:38 pm
by Temor
It depends entirely on what you want to use it for. I'll give you an example of how it might look for email purposes like in Gmail.
The star has an " onclick " function attached to it, so that when the star is clicked it will set " Star " to " true ". They then check to see if " Star " is " true ". If it is, that means it's Starred and should be put in a separate inbox.
UPDATE `emails` SET `star` = 'true' WHERE `email_id` = 1
if($star = true){
echo "star is true".
}

Really, this would be very easy for you if you had some basic understanding of PHP coding, or coding in general.
I would suggest you start by watching some Basics tutorials and then work your way up to longer series of tutorials.

Re: simple rating sytem

Posted: Mon Jul 09, 2012 4:29 pm
by mhakd14
realy thank you.You are a great helper