1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

picking words from a txtfile

Discussion in 'Programming' started by izlik, Nov 9, 2008.

  1. #1
    Hello.

    i have a txtfile with about 300 words in it. currently seperated by a comma "word1,word2,word3," and i was wondering if it's possible in HTML or PHP to pick out at random from that txtfile 30 words and display then asweel as have the word link to someting like for example http://mypage.com/[word]

    i hope someone could help me ifthis is possible.
     
    izlik, Nov 9, 2008 IP
  2. happpy

    happpy Well-Known Member

    Messages:
    926
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    120
    #2
    sure. this is easy

    <?
    $a=file_get_contents("thefile.txt");
    $a=explode(",",$a);
    shuffle($a);
    foreach($a as $b){
    echo"<a href=\"http://search.43.gs/$b\">$b</a> ";
    $n=$n+1;if($n==30){break;}
    }
    ?>
    Code (markup):
    enjoy.
     
    happpy, Nov 10, 2008 IP