Here is a snaphop of my main predictions table
Here is how it works. Member comes on the site and select a game for predictions. He gets to put the scores for team1 and for team 2
then he gets to put who will score (from the checkboxes) and at what minute that score will happened in the textbox, separating 2 goals for same player by a space. (in my example I simulated a prediction for 5 goals and 4 inputs for minutes, one of them having scored twice, so same textbox has 2 value).
I have only one input per game per member, meaning in that structure I am posting in this post, a single line holds all the values serialized (although the prdplayer serialize was not necessary) . The rest is accomplish with LEFT JOIN. I am also posting how it looks in db.
And here is how I insert in the prediction table
PHP Code:
if ($_POST['do']=='dopredict') {
if (!$bbuserinfo['userid'] OR !($permissions['forumpermissions'] & CANVIEW))
{
print_no_permission();
}
$user=$bbuserinfo[userid];
$seasonid = $_POST['seasonid'];
$thedivision = $_POST['divid'];
$tid1 = $_POST['teamid1'];
$tid2 = $_POST['teamid2'];
$gameid = $_POST['gameid'];
$predscore1 = $_POST['predscore1'];
$predscore2 = $_POST['predscore2'];
$predminutes1 = serialize($_POST['predminutes1']);
$predminutes2 = serialize($_POST['predminutes2']);
$tplayer1 = serialize($_POST['predplayer1']);
$tplayer2 = serialize($_POST['predplayer2']);
$DB_site->query("INSERT INTO cclpinternational_predictions(id,userid,gameid,divid,seasonid,teamid1,teamid2,predscore1,predscore2,predplayer1,predplayer2,predminutes1,predminutes2) VALUES ('NULL','$user','$gameid','$thedivision','$seasonid','$tid1','$tid2','$predscore1','$predscore2','".addslashes($tplayer1)."','".addslashes($tplayer2)."','$predminutes1','$predminutes2')");
$_REQUEST['forceredirect'] = 1;
$url = "interschedule.php?cupid=$thedivision";
eval(print_standard_redirect('redirect_predictionthanks'));
}