Jump to content


Photo

query then adding...


  • Please log in to reply
2 replies to this topic

#1 2wasted

2wasted
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 13 June 2006 - 08:43 PM

can i query the mysql DB and add them for display?i have a guestbook i put a vote on so when i goto the table it says name,email,comment,then there are 2 rows for the vote 'yesvote' and 'novote' with a 1 where there vote is.could i echo out the total added together?
cheers
Charlie

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 13 June 2006 - 08:46 PM

you would probably be better having one such field, 1 for yes 0 for no and then getting the average number and multipying it by 100 to get a % style approval result

example:

SELECT AVG (`rating`) FROM `table`
z..z..z..z..z..z..z..z..

#3 2wasted

2wasted
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 13 June 2006 - 09:25 PM

thx m8 i'll give that a go:-)
cya
Charlie




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users