943,703 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 849
  • PHP RSS
Oct 14th, 2008
0

Is there anything like this in php???

Expand Post »
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.
Reputation Points: 17
Solved Threads: 8
Posting Whiz in Training
mrcniceguy is offline Offline
278 posts
since Mar 2008
Oct 14th, 2008
0

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

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.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Oct 14th, 2008
0

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

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);"
}
Reputation Points: 17
Solved Threads: 8
Posting Whiz in Training
mrcniceguy is offline Offline
278 posts
since Mar 2008
Oct 14th, 2008
1

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

Close.
Like this
php Syntax (Toggle Plain Text)
  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.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Oct 14th, 2008
1

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

Thank you, it is working)))))
Reputation Points: 17
Solved Threads: 8
Posting Whiz in Training
mrcniceguy is offline Offline
278 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Restrict Access after update
Next Thread in PHP Forum Timeline: HAVE A LOT OF THANK YOU VERY MUCH thái san





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC