Forum Moderators: coopster

Message Too Old, No Replies

How to wrap text in guestbook script

         

adammc

11:57 pm on Sep 3, 2004 (gmt 0)

10+ Year Member



Hi,
I am trying to setup a guestbook and wish to wrap the text as the guestbook entries are going to be too long.

I have found many instructions on how to do it but none that i can work out how to tie in with 'my' php code

Can anyone help?


<?
//the host, name, and password for your mysql
mysql_connect("localhost","username","password");

//select the database
mysql_select_db("epidemic_guestbook");

if($submit)
{
//use the PHP date function for the time

$offset = 3600*10;
$time = gmdate("dS F Y, G:i", time() + $offset);




// inserting it into the shoutbox table which we made in the mysql statements before
$result=MYSQL_QUERY("INSERT INTO shoutbox (id,name,message,time)".
"VALUES ('NULL','$name', '$message','$time')");
}
?>

<?
//returning the last 5 messages
$result = mysql_query("select * from shoutbox order by id desc limit 5");

//the while loop
while($r=mysql_fetch_array($result))
{
//getting each variable from the table
$time=$r["time"];
$id=$r["id"];
$message=$r["message"];
$name=$r["name"];
?>

&nbsp;&nbsp;&nbsp;<b>Posted by:</b>&nbsp;<? echo $name?><br>
&nbsp;&nbsp;&nbsp;<b>Date:</b>&nbsp;<? echo $time?><br>
&nbsp;&nbsp;&nbsp;<b>Message:</b>&nbsp;<font size="3" face="">
<? echo $message?></font><br><br><br><br>
<? }?>

[edited by: coopster at 12:58 pm (utc) on Sep. 4, 2004]
[edit reason] generalized username and password [/edit]

ergophobe

1:03 am on Sep 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Will the php wordwrap() [php.net] function do it for you?

Tom

adammc

5:34 am on Sep 4, 2004 (gmt 0)

10+ Year Member



Thanks ergophobe,
you beat me to it, problem solved :)