|
|
|
|
|
|
|
|
|
#4 |
|
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
Code:
<pre>
<?php
$links = array(
"arrayitem1",
"arrayitem2",
"arrayitem3",
"arrayitem4",
"arrayitem5",
"arrayitem6",
"arrayitem7",
"arrayitem8",
"arrayitem9",
"arrayitem10",
"arrayitem11"
);
$randomized_links=array_rand($links,3);
print_r($randomized_links);
foreach ($randomized_links as $linknumber) {
print $links[$linknumber] . "\n";
}
shuffle($links);
print_r(array_slice($links,0,4));
?>
With SQL (and I really hate when this is done on a live site) you can do something like: Code:
select linkname,linkurl from tablename where category='teen' order by rand() limit 10;
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
|
|
|
|
|