Re: [PHP] How to wrap output of formatted text
In article 05d201c0a069$4877e0c0$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Clayton Dukes") wrote: $row = mysql fetch array($sth); if ($row[0] != "") { echo $row[0]; prints the data, but some of the results are long strings of text that don't wrap in the browser, how can I force them to wrap at the edge of the browser? You already discovered the wordwrap() solution. The html solution looks like this: if ($row[0] != "") { echo "p$row[0]/p"; Cheers! -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to wrap output of formatted text
Hi all, how can I tell the output from a mysql query to wrap the cols at 80 (or whatever)? here's what I have: $row = mysql_fetch_array($sth); if ($row[0] != "") { echo $row[0]; prints the data, but some of the results are long strings of text that don't wrap in the browser, how can I force them to wrap at the edge of the browser? Thanks, Clayton Dukes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to wrap output of formatted text
Nevermind, I got it :-) I used: function wraptext($text,$warp) { $text = explode(" ", $text); $i = 0; $length = 0; while ($i = count($text)) { $length += strlen($text[$i]); if ($length = $warp) { $output .= $text[$i]." "; $i++; } else { $output .= "\n"; $length = 0; } } return $output; } Then in the php file: echo (wraptext($row[0],80)); I'm learning :-) - Original Message - From: Clayton Dukes To: [EMAIL PROTECTED] Sent: Monday, February 26, 2001 9:59 PM Subject: [PHP] How to wrap output of formatted text Hi all, how can I tell the output from a mysql query to wrap the cols at 80 (or whatever)? here's what I have: $row = mysql_fetch_array($sth); if ($row[0] != "") { echo $row[0]; prints the data, but some of the results are long strings of text that don't wrap in the browser, how can I force them to wrap at the edge of the browser? Thanks, Clayton Dukes -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to wrap output of formatted text
There's a PHP function that does this. See: http://www.php.net/wordwrap Sig for a Day Stephan Ahonen, ICQ 491101 "That's very funny Scotty, now beam down my clothes!" Come back tomorrow for a different sig! Backspace a single "s" to reply by email -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]