NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 09-28-2010, 09:28 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
hoops's Avatar
Join Date: Sep 2006
Posts: 449
hoops is a jewel in the roughhoops is a jewel in the roughhoops is a jewel in the rough
 



PHP Help


I have a PHP script that pulls a .txt file and displays the results for
me.

I need the scipt to limit the number of letters it shows to me to not more than 15 letters, but not 15 letters exactly.

Can someone show me a code example on how to do this please?

Thanks!
hoops is offline   Reply With Quote
Old 09-29-2010, 09:56 AM   #2 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,069
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15?
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline   Reply With Quote
Old 09-29-2010, 05:08 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
hoops's Avatar
Join Date: Sep 2006
Posts: 449
hoops is a jewel in the roughhoops is a jewel in the roughhoops is a jewel in the rough
 



Originally Posted by yilduz View Post
What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15?
Yes less than 15 characters.
hoops is offline   Reply With Quote
Old 09-29-2010, 06:18 PM   #4 (permalink)
New Moderator
 
Deathstarr's Avatar
Join Date: Aug 2005
Location: Springville Al
Posts: 790
Deathstarr has much to be proud ofDeathstarr has much to be proud ofDeathstarr has much to be proud ofDeathstarr has much to be proud ofDeathstarr has much to be proud ofDeathstarr has much to be proud ofDeathstarr has much to be proud ofDeathstarr has much to be proud ofDeathstarr has much to be proud of
 




So you want to pull the data from a txt file and show results for words with 1-15 letters. Correct?
Deathstarr is offline   Reply With Quote
Old 09-29-2010, 06:33 PM THREAD STARTER               #5 (permalink)
NamePros Regular
 
hoops's Avatar
Join Date: Sep 2006
Posts: 449
hoops is a jewel in the roughhoops is a jewel in the roughhoops is a jewel in the rough
 



Originally Posted by DotElement View Post
So you want to pull the data from a txt file and show results for words with 1-15 letters. Correct?
Yes - I have all of the code and it works find with displaying the characters, but I need from 1-15 characters only.
????: NamePros.com http://www.namepros.com/programming/679540-php-help.html

Here is the line that I think needs to be edited.

$length = (strlen($length) > 0) ? $length : null;
hoops is offline   Reply With Quote
Old 09-30-2010, 06:01 PM   #6 (permalink)
NamePros Member
Join Date: Nov 2003
Location: Ontario, Canada
Posts: 127
eagle12 will become famous soon enougheagle12 will become famous soon enough
 



PHP Code:
$catString substr($length,0,15); 
eagle12 is offline   Reply With Quote
Old 10-02-2010, 07:25 AM   #7 (permalink)
NamePros Regular
 
baxter's Avatar
Join Date: Apr 2006
Posts: 360
baxter is just really nicebaxter is just really nicebaxter is just really nicebaxter is just really nice
 


Ethan Allen Fund Save The Children
If your using this in a loop of strings below will allow anything greater then 0 characters and less then 15 characters

Code:
$length = (strlen($length) > 0 AND strlen($length) <= 15) ? $length : null;
__________________
Canadian Domain Registrar Ready.ca
baxter is offline   Reply With Quote
Old 11-19-2010, 04:55 AM   #8 (permalink)
New Member
Join Date: Nov 2010
Posts: 5
johanwhite is an unknown quantity at this point
 



I think you want just 1-15 letters. Then you should try the following code.
$length = (strlen($length) >= 1 AND strlen($length) <= 15) ? $length : null;
I hope after using this code, you will solve your problem.
Thank you.
__________________
Toshiba coupon code
johanwhite is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:38 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger