Hi,
My problem is that my script doesn't give users extra points for predicting the exact score. It does give users 3 points for predicting the winner.
I have got 3 tables;
$table1-->here is where i put the matchinfo. Important fields here are UITSLAG1 and UITSLAG2. It's where i put the final result of the match.(homegoals and awaygoals).
$table2-->here is where i put the userinfo. Important field here is PUNTEN. It's where i put the users total points.
$table3-->here is where i put the prediction info. Important fields here are TEAM1 and TEAM2. It's where the users predict the score for each team.
Could someone please help me?
Here's my script ( a part of it):
<?
$a="1";
$b="1";
$query99="SELECT * FROM $tabel1";
$result99=mysql_query($query99,$db);
while($wedstrijd=mysql_fetch_array($result99))
{
$winnaar[$a]="$wedstrijd[uitslag]";
$query1="SELECT * FROM $tabel3 WHERE winnaar='$winnaar[$a]'";
$result1=mysql_query($query1,$db);
while($us=mysql_fetch_array($result1))
{
$gebruiker[$b]="$us[gebruikersnaam]";
$query2="SELECT * FROM $tabel2 WHERE gebruikersnaam='$gebruiker[$b]'";
$result2=mysql_query($query2,$db);
while($rech=mysql_fetch_array($result2))
{
$totalpoints=("$rech[punten]" + "3");
$sql="UPDATE $tabel2 SET punten='$totalpoints' AND gebruikersnaam='$gebruiker[$b]'" or die ("Update mislukt!!");
$result=mysql_query($sql,$db);
$result = mysql_query("DELETE FROM $tabel3 WHERE winnaar='$winnaar[$a]' AND gebruikersnaam='$gebruiker[$b]'");
$a++;
$b++;
}
}
}
$result = mysql_query("DELETE FROM $tabel3");
echo "<b><center>Alle punten zijn geupdate";
?>