Solved

random link

Posted on 2007-03-21
4
188 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
  • 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

813 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now