PDA

View Full Version : Prediction League


craighowarth
09-16-2006, 12:22 PM
Hey Guys...

I have started running a prediction league for this years new premiership season, and at the moment i seem to be doing everything manual - that was fine. But with the amount of members, its starting to take the piss abit.

What i want to know is...

We have a scoring system of...

Correct Score (exact scoreline of the match) - 3 points
Correct Prediction (eg. Prediction: Newcastle 10-0 Fulham, the score was Newcastle 11-0 Fulham, basically... home win etc.) - 0 points
Incorrect Score + Prediction - 0 points

If i get the scores submitted to a database for example...

*Member Name* | *Prediction*

Bob | 3-0

How will i be able to make it so i can...

1) send a email confirming i have recieved the predictions when its submitted to the database
2) make the table update itself after the matches

Cheers :thumbsup:

iota
09-16-2006, 03:15 PM
Let me suggest a little:

As your site is kind of LIVE system for soccer sport, you'd better use the AJAX to update periodically what you want.
For this, you can use the "Periodic Updater" function prototype.js (http://prototype.conio.net/).

Fumigator
09-16-2006, 05:15 PM
If you don't want to mess with Ajax then you can use the Javascript function setInterval. It's rather simple, you just add this to your <body> tag:


<body onload="startInterval();">


And then have two functions that begins the interval check:


function startInterval() {
//check scores every 60 seconds
updateInt = setInterval("updateScores()", 60000);
}

function updateScores() {
//do whatever needs to be done to update scores here
document.form1.submit();
}

craighowarth
09-18-2006, 06:46 PM
If you don't want to mess with Ajax then you can use the Javascript function setInterval. It's rather simple, you just add this to your <body> tag:


<body onload="startInterval();">


And then have two functions that begins the interval check:


function startInterval() {
//check scores every 60 seconds
updateInt = setInterval("updateScores()", 60000);
}

function updateScores() {
//do whatever needs to be done to update scores here
document.form1.submit();
}


Sorry to sound extremely thick but im very new to PHP - what would i put in there...:confused:

Fumigator
09-19-2006, 02:43 PM
You mentioned you have a manual process right now, so I just assumed you'd take what you do manually and shove it in there. I know nothing about the details of what has to happen so I can't write the script for you.