Hi, being a newbie I'm a bit stuck.
I'm doing a query on one fieed on a mysql table and trying to put all the rows returned into array to use to randomize my page colors..
heres where I got to, but the below always ends up with the same page color coming out.
$bg_colors = mysql_query("SELECT bg_color FROM $db_mythog_table");
while($row = mysql_fetch_array($bg_colors))
{
$bg_Array[$row[0]] = $row[1];
}
while(list($key) = each($bg_Array))
{
$input = array($key);
$bg_rand = array_rand($input);
$bg_rand = date("d") % sizeof($input);
$bg = $input[$bg_rand];
}
I guess the array_rand is not doing much as it seems that there is only one value going into the array from the query. I'm sure theres an easy way that I must be missing, but I'm a bit of a newie to working with arrays.
Thanks,
praccus