Results 1 to 4 of 4

Thread: Had to pass this along...

  1. #1
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default Had to pass this along...

    I noticed that on certain pages here on glowhost.com, the customer testomonial will change each time you refresh the browser, so you get a fresh, dynamic comment each time. That's cool stuff and I have done the same for one of my clients on www.biplaneride.com. I thought I'd pass it along, if it is of use for anyone else. Really, all the work is done in the SQL query. Check it out.

    PHP Code:
     $query "SELECT commentData FROM comments WHERE LENGTH(commentDATA) < 150 AND approved = 1 ORDER BY RAND() LIMIT 1";
    $result mysql_query($query);
    $num_results mysql_num_rows($result); 
    Then later on, just echo out the results:

    PHP Code:
    echo htmlspecialchars(stripslashes(mysql_result($result0"commentData"))); 
    CharlesH

  2. #2
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Thanks for the script CharlesH - I hope to use this one day!
    The site you mentioned: www.biplaneride.com - do you do flash yourself?
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  3. #3
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default

    Yes, I did do the flash and it really looks more difficult than it is. I am getting better with it, tho and you can do a lot of cool stuff with actionscript.

    Charlesh

  4. #4
    dansgalaxy's Avatar
    dansgalaxy is offline Junior Web Sage
    Join Date
    Jun 2008
    Location
    Swindon, UK
    Posts
    9

    Default

    Hmm, i have my random quote slightly different, my database is set up so i have the main testimonial stored and i then select 4 quotes and put them into seperate fields and then have it select a random quote

    will have to see if i can get more of the logic into the SQL tho

    Dan

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12