Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-05-2005, 10:14 AM   #1
galleryseek
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 8,234
PHP / MySQL Gurus : Help me inside.

$query = "UPDATE `hgarticlerate` SET votes=votes+1, score='hgarticlerate.votes/($vote+hgarticlerate.score)' WHERE articleid='15'";

now I know this has to be wrong, because I've never done anything like it and I couldn't find anything on the net about it (and uhm, yeah i tried running it and it also doesn't work )

basically what i'm trying to do for field "score" is perform an average by first adding the current value of "score" (hgarticlerate.score) to the new vote submitted ($vote), and then dividing it by the votes field (hgarticlerate.votes)

i'm sure i just have the syntax screwed up, or I'm leaving out a function in mysql that will do this easier. help?
galleryseek is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-05-2005, 10:28 AM   #2
vending_machine
Confirmed User
 
Join Date: Jun 2002
Location: Seattle
Posts: 1,062
Your code would look like this (you have your arithmetic wrong for the score, you will have to fix that ;) ):

Code:
UPDATE `hgarticlerate` SET votes = votes + 1 , score = votes / ( '$vote' + score ) WHERE articleid = '15';
vending_machine is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-05-2005, 10:44 AM   #3
galleryseek
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 8,234
Quote:
Originally Posted by vending_machine
(you have your arithmetic wrong for the score, you will have to fix that ;) ):
how is it wrong??

thanks btw.
galleryseek is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.