Trouble with array
Posted: Thu Jul 13, 2006 12:29 am
Hey guys... For some reason with the code below... the array $arrayThreadTimes is not being created correctly and populated correctly. I know it is something simple I am missing here. Perhaps you guys could take a look and tell me if I have something wrong with this code. Thanks a bunch!
Code: Select all
$start = 1152691200 + 18000; ## 07/12/06 @ 8 am
$end = 1152813600 + 180000; ## 07/13/06 @ 6 pm
$query = "SELECT COUNT(threadid) FROM thread";
$result = mysql_query($query);
$set = mysql_fetch_row($result);
$numThreads = $set[0];
$arrayThreadTimes = array();
for ($i = 0; $i < $numThreads; $i++)
{
$randTime = rand($start, $end); ## Add 1800 for US Eastern Time.
while ($randTime > (1152747000+18000) && $randTime < (1152777600+18000))
{
$randTime = rand($start, $end);
}
$arrayThreadTimes['$i'] = $randTime;
}
sort($arrayThreadTimes, SORT_NUMERIC);
print_r($arrayThreadTimes);