Chosing a variable from random columns and rows
Posted: Sun Mar 26, 2006 7:56 pm
I have columns website, website1, website2, website3, and website4
Each has a link as its value.
I need $website to be one random link from those 4 columns from a random row.
My current code is this:
But now I want it to pick $website from more than just the `website` column. What do I do?
Each has a link as its value.
I need $website to be one random link from those 4 columns from a random row.
My current code is this:
Code: Select all
$sql="SELECT * FROM `accounts` WHERE points > 1 ORDER BY RAND() LIMIT 1";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$website = $row["website"];