I have a table called say “ARTICLES” in die db called “MYDB” with a number of fields. The applicable field is where the actual article will be placed. This is called “ARTICLE” and of type TEXT. There is an option (which might be applicable later) called Attributes with 3 options: Binary, unsigned, and unsigned zero, which I don’t know what for. But, at the moment it is blank.
Now, I access the Database through my php code without any hassles. A make additions to the database without any problem.
Basically, I have an HTML form:
Code: Select all
<form action="addarticle.php" method="post">
<textarea rows="10" name="art" cols="50"></textarea>
<input type="submit" value="Ok" name="add">
</FORM>This works well. Then add the data to the DB:
Code: Select all
$SQL = "INSERT INTO ARTICLES VALUES ('$art')";At this point all is well. Then In another script I extract the data:
Code: Select all
$SQL = "SELECT ARTICLE FROM ARTICLES";
$RESULT = mysql_query($SQL);
if (!$RESULT)
{
die('Could not retrieve data: ' . mysql_error());
}Then display it:
Code: Select all
while ($ROW = mysql_fetch_assoc($RESULT))
{
echo $ROW["ARTICLE"];
}Still, it works fine. But the problem is, even though the data was typed by the user using paragraph breaks (enter) and so on, it does not display as such. In stead it’s all just one continues paragraph. I checked to see if the problem was done in my INSERT phase, but viewing the data in PHPMyAdmin, it is fine and printed in paragraphs. Therefore, the problem must be at the representation part:
Code: Select all
Echo $ROW[“ARTICLE”];I’m sure this is something simple for you guys.
Thanks for the time.