SSdraken
08-12-2005, 10:37 PM
Hey, I'm new here :)
I have been working on a really simple mysql/php set of pages.
Page 1: Input 3 peices of data (Title, Date and Text)
Page 2: Display all news that has been inputted
I have it working, except for one problem. My website is built with html, and tables. I want it so that when the text gets to the edge of the table, it drops down a line and starts again on the next line - so it doesn't carry on and on. Theres no problem with title and date - they're just a few words, but the text
part of the news is usually 5 or 6 lines long. This means that it wont all fit on one line without ruining the entire website display.
this is the current version i have running:
http://ssdraken.aspfreeserver.com/news.php
as you can see, everything is being pushed to the right because of the long
lines of text that are being displayed by my php code.
<?php
$username="username";
$password="password";
$database="draken";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM news order by ID desc";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<br><br>";
$i=0;
while ($i < $num) {
$TITLE=mysql_result($result,$i,"TITLE");
$DATE=mysql_result($result,$i,"DATE");
$LINE1=mysql_result($result,$i,"LINE1");
echo "<b>$TITLE</b><br>$DATE<br><BR><i>$LINE1</i><br><br>";
$i++;
}
?>
this is the code that i'm running on the news display page. Can someone please fix my problem? I'm sure its incredibly easy I just don't know how to do it.
I have been working on a really simple mysql/php set of pages.
Page 1: Input 3 peices of data (Title, Date and Text)
Page 2: Display all news that has been inputted
I have it working, except for one problem. My website is built with html, and tables. I want it so that when the text gets to the edge of the table, it drops down a line and starts again on the next line - so it doesn't carry on and on. Theres no problem with title and date - they're just a few words, but the text
part of the news is usually 5 or 6 lines long. This means that it wont all fit on one line without ruining the entire website display.
this is the current version i have running:
http://ssdraken.aspfreeserver.com/news.php
as you can see, everything is being pushed to the right because of the long
lines of text that are being displayed by my php code.
<?php
$username="username";
$password="password";
$database="draken";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM news order by ID desc";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<br><br>";
$i=0;
while ($i < $num) {
$TITLE=mysql_result($result,$i,"TITLE");
$DATE=mysql_result($result,$i,"DATE");
$LINE1=mysql_result($result,$i,"LINE1");
echo "<b>$TITLE</b><br>$DATE<br><BR><i>$LINE1</i><br><br>";
$i++;
}
?>
this is the code that i'm running on the news display page. Can someone please fix my problem? I'm sure its incredibly easy I just don't know how to do it.