hello, for my lucky draw script I am going to take the following steps:
- select timestamp previous draw and curent timestamp
- select grids played between those dates
- compare the grids played with the current lucky draw numbers
- depending on the result (1, 2 3,4 numbers: 1 action, 5 and 6 numbers: 2 different action)
I am stuck with one thing here: in my loop I am retrieving a lot of information, out of which I will use only one field to compare with the winning numbers.
right now a print_r($data[$i]); does not return anything... no array at all.
is there anything I have done wrong in the loop?
by the way: will I have to use explode() implode() in the array if I want to compare the 3 field in this array with the winning numbers (which are stored in a variable as a string)
thanks!
I leave you with the code here if someone can take a look at it.
//select the n-1 date a lucky draw took place
$query = ("SELECT date FROM grids_winning ORDER BY id_grids DESC LIMIT 1,1");
$result = mysql_query($query) or die('Invalid query: ' . mysql_error());
//store it into an array
// this will be useful in order to compare ONLY new grids for the current draw and diregards PREVIOUS grids
$dateprev = mysql_fetch_assoc($result);
$dateprevious = implode('',$dateprev);
//current date
$datecurrent = time();
//select the grids played after last draw only
$query = ("SELECT * FROM grids_clients WHERE timeplayed BETWEEN $dateprevious AND $datecurrent");
$result = mysql_query($query) or die('Invalid query: ' . mysql_error());
$return = mysql_fetch_assoc($result);
for ($i = 0; $i < count($return); $i++)
{
$data[$i] = $return[$i];
print_r($data[$i]);
}