dans le script ci dessous je voudrais que pour les utilisateurs ayant 1 numero juste sur la grille recoivent 100 points, 2 numeros: 200 pts etcetc.
tout marche au poil jusqu'a la requete d'insertion qui plante
normalement apres celle ci: j'ai fini!
merci
qq un pourrait me dire ce que je fais mal?? (a mon avis c'est la boucle que je place au mauvaus endroit (entre autre...)
$query = ("SELECT * FROM grids_clients WHERE timeplayed BETWEEN $dateprevious AND $datecurrent");
$run_query = mysql_query($query) or die('Invalid query: ' . mysql_error());
//initialize counter: used to extract grids played by clients depending on the date
$counter = mysql_num_rows($run_query);
print "$counter<br><br><br>";
//loop starts
$i = 0;
while ($i < $counter)
{
$id_clients = mysql_result($run_query,$i,"id_clients");
$temp_grids = mysql_result($run_query,$i,"grids_1");
$client_grids = strtoArray($temp_grids);
//returns the difference between the lucky draw and the grids played by the client. returns a string
$diff = count(array_diff($client_grids, $draw));
$win = 6 - $diff;
//add data to recursive array
$array[$i]=array("win"=>$win,"id_clients"=>$id_clients);
list($key, $val) = each($array[$i]);
//inserer une loop avec pour parametre $key
$j = 0;
while($j < $counter)
{
$points = $key*100;
$query= ("INSERT INTO winners (id_winner, winning_numbers, date) VALUES ('$val', '$key', '$datecurrent')");
mysql_query($query) or die('Invalid query: ' . mysql_error());
$query= ("UPDATE clients SET points WHERE id_clients = $val");
mysql_query($query) or die('Invalid query: ' . mysql_error());
}
print "<br>";
$i++;
}
mysql_close();
?>