GlowHost Web Hosting Forums  

Go Back   GlowHost Web Hosting Forums > In The Lounge > Programming Talk
Register Forum FAQ Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-05-2007
charlesh's Avatar
Master Glow Jedi
 
Join Date: Aug 2006
Location: Wichita, Kansas - better than you imagined it would be.
Posts: 152
Rep Power: 37
charlesh is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-07-2007
rlhanson's Avatar
Master Glow Jedi
 
Join Date: Aug 2007
Location: Chapman, Kansas
Posts: 347
Rep Power: 35
rlhanson will become famous soon enough
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-07-2007
charlesh's Avatar
Master Glow Jedi
 
Join Date: Aug 2006
Location: Wichita, Kansas - better than you imagined it would be.
Posts: 152
Rep Power: 37
charlesh is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-24-2008
dansgalaxy's Avatar
Junior Web Sage
 
Join Date: Jun 2008
Location: Swindon, UK
Posts: 10
Rep Power: 0
dansgalaxy is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:26 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO
Copyright 2000-2007 GlowHost.com