JamesCliff
Programmer
Hi all,
Right im having some problems with the wordwrap function.
Basiclly the script below calls from a database which populates the wordwrap function. However its not working. What i want is to limit the amount of characters per line so that my site dosnt stretch apart when the user types some information into the home page edit php script which updates the database table. The home.php which is the script below then calls from the database, however the information called from the database was displayed in long lines which are to big for the page therefore making the site distort. This is why im trying to use the wordwrap function to limit the amount of characters per line.
The problem with the code below is that it dosnt display anything on the page, goto to see the home page, there is nothing on it. How do i get it working so the wordwrap function limits the amount of characters per line to say 100, and also so that it actually displays the data in the database table.
Any help is greatly appriciated.
Thanks alot
Jim
Right im having some problems with the wordwrap function.
Basiclly the script below calls from a database which populates the wordwrap function. However its not working. What i want is to limit the amount of characters per line so that my site dosnt stretch apart when the user types some information into the home page edit php script which updates the database table. The home.php which is the script below then calls from the database, however the information called from the database was displayed in long lines which are to big for the page therefore making the site distort. This is why im trying to use the wordwrap function to limit the amount of characters per line.
The problem with the code below is that it dosnt display anything on the page, goto to see the home page, there is nothing on it. How do i get it working so the wordwrap function limits the amount of characters per line to say 100, and also so that it actually displays the data in the database table.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
<table width="724">
<!--DWLayoutTable-->
<tr>
<td width="100%" height="261" valign="top"><div align="center">
<p> </p>
<p><font size="2"><strong>Home of GB Plant and Machinery</strong></font></p>
<p> </p>
<?
mysql_connect("127.0.0.1","jim11","") or die("Could not connect to SQL server!");
mysql_select_db("gbplantandmachinery") or die("Could not find database!");
$table = "home" ;
$sql = "select `homeid`, `context` from $table";
$rslt = mysql_query($sql);
$input = $result['context'];
$output = wordwrap($input);
while ($result = mysql_fetch_array($rslt))
{
echo "<table width='650'>";
echo "<tr>";
echo '<td><pre><font face="Verdana, Arial, Helvetica, sans-serif">' . $output .'</font></pre></td>
</tr>';
}
echo "</table>";
?>
</div></td>
</tr>
</table>
</div>
</body>
</html>
Any help is greatly appriciated.
Thanks alot
Jim