User Tag List

Results 1 to 2 of 2

Thread: Get random words from my list...

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Get random words from my list...

    I took the word checker a step farther.

    For the game I'm currently working on, I want to get a word from my database (hosted online).

    So I modified the script that LB helped me with. This new PHP script resides on my server, and is available for clickteam users to use in their FLASH word games (doesn't have to be flash).

    Simply pass a get statement with 1 variable 'l'
    which tells the PHP code the LENGTH of the word you need. Right now, 'l' must be between 4 and 9
    Try it out! Click any of the links below and it will return a random word from the list having a length of 4 to 12...

    http://pixelkick.com/GetWord.php?l=4
    http://pixelkick.com/GetWord.php?l=5
    http://pixelkick.com/GetWord.php?l=6
    http://pixelkick.com/GetWord.php?l=7
    http://pixelkick.com/GetWord.php?l=8
    http://pixelkick.com/GetWord.php?l=9
    http://pixelkick.com/GetWord.php?l=10
    http://pixelkick.com/GetWord.php?l=11
    http://pixelkick.com/GetWord.php?l=12

    I'll add in word lengths higher than 12 as well, but for now 4-12 is what I've done.




  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Get random words from my list...

    If anyone is interested, here's how I did it...

    Note that you can see how many words are in each list...

    Code:
    <?
    
    $length = $_GET['l'];
    
    $service="#####";
    $username = "######";
    $password="###########";
    $database = "###########";
    
    mysql_connect($service, $username, $password);
    @mysql_select_db($database) or die( "Unable to select database");
    
    if($length == 4)
    {
    $random = strval(mt_rand(1,2293));
    $query = "Select word from List4 where id = '$random'";
    }
    if($length == 5)
    {
    $random = strval(mt_rand(1,4268));
    $query = "Select word from List5 where id = '$random'";
    } 
    if($length == 6)
    {
    $random = strval(mt_rand(1,6936));
    $query = "Select word from List6 where id = '$random'";
    } 
    if($length == 7)
    {
    $random = strval(mt_rand(1,9203));
    $query = "Select word from List7 where id = '$random'";
    } 
    if($length == 8)
    {
    $random = strval(mt_rand(1,9394));
    $query = "Select word from List8 where id = '$random'";
    }
    if($length == 9)
    {
    $random = strval(mt_rand(1,7696));
    $query = "Select word from List9 where id = '$random'";
    } 
    
    if($length == 10)
    {
    $random = strval(mt_rand(1,6377));
    $query = "Select word from List10 where id = '$random'";
    } 
    
    if($length == 11)
    {
    $random = strval(mt_rand(1,4557));
    $query = "Select word from List11 where id = '$random'";
    } 
    
    if($length == 12)
    {
    $random = strval(mt_rand(1,3101));
    $query = "Select word from List12 where id = '$random'";
    } 
    
    
    $result = mysql_query($query);
    
    while ($row = mysql_fetch_assoc($result))
    {
        exit($row['word']);
    }
    ?>

Similar Threads

  1. Pick Random but delete from possible list?
    By EdibleWare in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 5th October 2013, 10:06 PM
  2. Random Item List
    By jotek in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 13th January 2009, 05:00 PM
  3. Random crashes at Event List Editor
    By Karzon in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 7th May 2008, 09:33 PM
  4. Replies: 17
    Last Post: 8th January 2007, 11:59 PM
  5. Dictionary Extension - common English words list
    By Jeff in forum File Archive
    Replies: 0
    Last Post: 19th December 2006, 12:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •