hello,
in my lotto script i would like to do the following things:
- draw the winning numbers (ok)
- compare all the grids played between today and the date of the previous draw
- return how many clients have 0, 1, 2, 3 ,4, 5 ,6 in their grid.
if the result is satisfactory: validation.
upon validation update a table with new information.
I currently have this code:
//works fine
$query = ("SELECT * FROM grids_clients WHERE timeplayed BETWEEN $dateprevious AND $datecurrent");
$result = mysql_query($query) or die('Invalid query: ' . mysql_error());
//loop: load $data with one field of the array (will be used for comparison with winning numbers
while ($return = mysql_fetch_assoc($result))
{
//compare grids: works fine
$rang=comparegrids(strtoArray($return['grids_1']) , strtoArray($grid));
//what the heck does that mean??
$resultat[$return['id_clients']]=array("rang"=>$rang,"grid"=>$return['grids_1']);
}
I dont understand the very last line... this cripples me for what follows where I would like to print on screen the number of grids/players with 1 correct number in their grids. (the idea being to do that for 0, 1, 2, 3, 4, 5, 6 correct numbers in the grid THEN validate)
while(list($id_player,$val)=each($resultat) ) {
$val1 = array_count_values($val['rang'], '1');
print"$val1";
}
can anyone help me get a better understanding of what this line does?
$resultat[$return['id_clients']]=array("rang"=>$rang,"grid"=>$return['grids_1']);
I would also be interested in understanding the steps: if anyone can come up with a strategy that would be really nice 🙂
thanks