| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Modal Average | |
|---|---|
| Tweet Topic Started: Mar 13 2005, 01:49 PM (270 Views) | |
| mathiaus | Mar 13 2005, 01:49 PM Post #1 |
|
mathiaus maximus™
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Just wondering if there was a way using either php or javascipt (preferably php but anything will do!) of working out the modal average of a bunch of numbers? I've checked google and some sites like phpfreaks but returned with no results thus far which would lead me to believe there is no way, however I just thought I'd ask you lot before I gave up hope. Thanks and Salutations MarthaStewart ( joke!)
|
![]() |
|
| kingy | Mar 13 2005, 02:18 PM Post #2 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
should be able to, how are these numbers defined? in an array? |
![]() |
|
| mathiaus | Mar 13 2005, 02:32 PM Post #3 |
|
mathiaus maximus™
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
It's sort of like a quiz with checkboxes. Each question has 4 answers each with a different number of points assigned to each one. eg. Q1 1 2 3 4 Q2 1 2 3 4 so say the person chose 1 and then 1 I'd like if it's possible to come up 1 (lots more questions obviously!) |
![]() |
|
| kingy | Mar 13 2005, 02:56 PM Post #4 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
in Js u could have a function to add one to the value of four different variables, dependant on a form input. then you could make a simple logic routine at the end to figure out which of the four variables ends up with the highest value. |
![]() |
|
| mathiaus | Mar 13 2005, 03:21 PM Post #5 |
|
mathiaus maximus™
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Thanks! I'll go and try that out then... |
![]() |
|
| kingy | Mar 14 2005, 02:08 PM Post #6 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
if you need any help i can make you a little template one...i was thinking u could do the same in php using the same method |
![]() |
|
| mathiaus | Mar 14 2005, 02:25 PM Post #7 |
|
mathiaus maximus™
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Right then I've got this in php
That works fine etc and is shorter than what the javacript would be I think? I started on the javascript but my knoledge of it is very small (size of a pea maybe another 1/2 if I'm lucky!). |
![]() |
|
| kingy | Mar 14 2005, 02:50 PM Post #8 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
cool...yeah the js would have been larger, i though it was for an IF site @ first so suggested js.lol |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
2:38 PM Jul 11
|



![]](../../../../0/1/0/p601690/pipright.png)
joke!)



2:38 PM Jul 11