How to use an array for this?

Discussion in 'PHP' started by megler, Nov 24, 2008.

  1. #1
    Hi everyone!

    I know how to use an array to rotate items, but I need to do something slightly more complicated:

    [​IMG]

    What I want to do is rotate the top row with the bottom row when the page is refreshed. I think I can do it with seperate arrays, but I'm not sure how to set it up. The only way I now how to set up an array is this:

    <?php
    $links = array(’http://www.link1.com’,'http://www.link2.com’);
    $link = $links[array_rand($links)];
    echo “<meta http-equiv=’refresh’ content=’0;url=$link’/>”;
    ?> 
    PHP:
    How would I change this so that it would flip the table contents back and forth?

    Thanks!
     
    megler, Nov 24, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Don't get your point, please give more details! :)
     
    EricBruggema, Nov 28, 2008 IP
  3. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Yes we would need more details.
     
    ads2help, Nov 28, 2008 IP
  4. misbah

    misbah Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    68
    #4
    did you mean like this
    
    <?php
    $myarray = array(
    	array('offer pic 1','offer 1'),
    	array('offer pic 2','offer 2'),
    	array('offer pic 3','offer 3'),
    	array('offer pic 4','offer 4'),
    	array('offer pic 5','offer 5')
    );
    
    shuffle($myarray);
    print_r($myarray);
    ?>
    
    Code (markup):
     
    misbah, Nov 28, 2008 IP
  5. parkerproject

    parkerproject Active Member

    Messages:
    114
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    98
    #5
    parkerproject, Nov 28, 2008 IP