Is there anything like this in php???

Reply

Join Date: Mar 2008
Posts: 217
Reputation: mrcniceguy is an unknown quantity at this point 
Solved Threads: 4
mrcniceguy mrcniceguy is offline Offline
Posting Whiz in Training

Is there anything like this in php???

 
0
  #1
Oct 14th, 2008
I WANT TO DISPLAY A CERTAIN WORD I STORED IN DATABASE WITH LETS SAY 14 CHARACTERS(LATTERS),NOW I WANT WHILE DISPLAYING IT AFTER REACHING THE 9TH LATTER TO BRAKE.
SOMTHING LIKE THIS.
MWAKISAMBUKEGE -----
TO GET
MWAKISAMB
UKEGE

If there is apossibility of doing this.Help me please.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Is there anything like this in php???

 
0
  #2
Oct 14th, 2008
I think this is what you are looking for
wordwrap($text, 14, "<br />\n", true);


modified to add the 4th argument to the function for hard break.
Last edited by R0bb0b; Oct 14th, 2008 at 2:28 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 217
Reputation: mrcniceguy is an unknown quantity at this point 
Solved Threads: 4
mrcniceguy mrcniceguy is offline Offline
Posting Whiz in Training

Re: Is there anything like this in php???

 
0
  #3
Oct 14th, 2008
do you mean i need to write like this????
$query="SELECT *FROM rad ";
$result="mysql_query($query)";
while($row=mysql_fetch_array($result)){
$text=$row['text'];
echo"wordwrap($text, 14, "<br />\n", true);"
}
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 849
Reputation: R0bb0b is on a distinguished road 
Solved Threads: 67
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Practically a Posting Shark

Re: Is there anything like this in php???

 
1
  #4
Oct 14th, 2008
Close.
Like this
  1. $query="SELECT *FROM rad ";
  2. $result="mysql_query($query)";
  3. while($row=mysql_fetch_array($result)){
  4. $text=$row['text'];
  5. echo wordwrap($text, 14, "<br />\n", true);
  6. }

The only change I made was fixed misplaced semicolon in last line and took out the double quotes.
Last edited by R0bb0b; Oct 14th, 2008 at 2:58 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss

-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 217
Reputation: mrcniceguy is an unknown quantity at this point 
Solved Threads: 4
mrcniceguy mrcniceguy is offline Offline
Posting Whiz in Training

Re: Is there anything like this in php???

 
1
  #5
Oct 14th, 2008
Thank you, it is working)))))
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC