thanks so much for helping. i've been working on this hours, and earlier i had gotten it right, somehow..
Is it working now?
You have two infinite loops, firstly the $int will always be less than 31 because you are generating a random number between 6 and 31.
And the second WHILE loop, $count will never not equal 1. Because $count is equal to nothing inside the function, look at this for example: -
<?php
$count = 1;
function test()
{
echo($count);
}
test();
?>
It outputs nothing.......
But this outputs 1: -
<?php
$count = 1;
function test()
{
global $count;
echo($count);
}
test();
?>
Using "global" for you should sort out the problem as demostrated by this code that outputs 2: -
<?php
$count = 1;
function test()
{
global $count;
$count++;
}
function test2()
{
global $count;
echo($count);
}
test();
test2();
?>
However you need to sort out the first $int WHILE loop problem first.
There are a number of ways you can achieve the same thing, by either passing $count in the functions parameters, returning the new $count value from the functions, or by using the "global" syntax like as shown in the above examples.