Solved

random link

Posted on 2007-03-21
4
193 Views
Last Modified: 2008-02-20
hello,
I would like to make something very simple for my site..
something like this

tutorial1 name link here
tutorial2 name link here
tutorial3 name link here

each time they refresh the same they change random places like this

tutorial2 name link here
tutorial3 name link here
tutorial1 name link here

can someone please help me do this?
0
Comment
Question by:Sabrin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 17

Expert Comment

by:HuyBD
ID: 18769241
first, you add all to array

$arr=array("link1","link2","link3");
then
$link=$arr[rand(0,3)];


HuyBD;
0
 
LVL 17

Accepted Solution

by:
HuyBD earned 500 total points
ID: 18769243
or

$arr=array("link1","link2","link3");
then
$link=$arr[rand(0,sizeof($arr))];

HuyBD;
0
 

Author Comment

by:Sabrin
ID: 18769246
ohh im not that good at php could you please make it easier for me?
0
 
LVL 17

Expert Comment

by:HuyBD
ID: 18769276
$arr=array("tutorial1 name link here","tutorial1 name link here","tutorial1 name link here");
$link=array_rand($arr,sizeof($arr));

for($i=0;$i<sizeof($link);$i++)
{
 echo $link[$i];
}

Hope this help

HuyBD;
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
deprecated mysql extensions 1 55
if statement malfunction 5 44
Code planning methods/tools? 5 56
Google Recaptcha 13 52
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question