From owner-freebsd-questions@FreeBSD.ORG Thu Jun 18 20:56:36 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1239A106578A for ; Thu, 18 Jun 2009 20:56:36 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from mail.potentialtech.com (internet.potentialtech.com [66.167.251.6]) by mx1.freebsd.org (Postfix) with ESMTP id D91DE8FC1A for ; Thu, 18 Jun 2009 20:56:35 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from vanquish.ws.pitbpa0.priv.collaborativefusion.com (pr40.pitbpa0.pub.collaborativefusion.com [206.210.89.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTPSA id 2E2B7EBC0A; Thu, 18 Jun 2009 16:56:35 -0400 (EDT) Date: Thu, 18 Jun 2009 16:56:34 -0400 From: Bill Moran To: Gary Kline Message-Id: <20090618165634.a6227d40.wmoran@potentialtech.com> In-Reply-To: <20090618204957.GA50728@thought.org> References: <20090618204957.GA50728@thought.org> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.14.7; i386-portbld-freebsd7.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List Subject: Re: radio-buttons and PHP; may be a bit OT. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2009 20:56:36 -0000 In response to Gary Kline : > After a lot of trial and error I have a PHP version of radio buttons > working in a test.php. It asks the user to rate the article/story > in standard Lykert (5-way) methodology. 1) Liked ... to 5) Disliked. > > The code works; still polishing for errors. I need a way to store the > results, tho. So, for story baz.php, say, should I save the count of > times rated, then average [%f] the ratings? Or is there a more swift > algorithm? In my experience, you're best off storing the raw data, then generating statistics in a separate step. That way, if you decide that you want to generate different statistics (mean vs. mode, for example) you still have the raw data to do so. If you're storing the results in a flat file, just have have the script append the new results to the end of the file, then have another process that comes along and reads the file, and generates a different file with the statistics. Of course, this is even easier if you're using a database. -- Bill Moran http://www.potentialtech.com http://people.collaborativefusion.com/~wmoran/