ChR0NiC
Oct 8th, 2006, 02:29 PM
$query = "SELECT * FROM helpfultips";
$result = mysql_query($query);
$i = 0;
while($row = mysql_fetch_array($result))
{
extract($row);
$tipsy[i] = $tip;
$i++;
}
$tipnum = rand(0, $i);
echo $tipsy[$tipnum];
I have this helpful tips table which has tips to be randomized every time you changed the page. But it won't show the tip! If I put the echo up in the loop it works but then it shows all of the tips, I only want one random one. I don't understand why it won't work, this has never happened to me before. Does anybody see a reason why it wouldn't work?
$result = mysql_query($query);
$i = 0;
while($row = mysql_fetch_array($result))
{
extract($row);
$tipsy[i] = $tip;
$i++;
}
$tipnum = rand(0, $i);
echo $tipsy[$tipnum];
I have this helpful tips table which has tips to be randomized every time you changed the page. But it won't show the tip! If I put the echo up in the loop it works but then it shows all of the tips, I only want one random one. I don't understand why it won't work, this has never happened to me before. Does anybody see a reason why it wouldn't work?