Jump to content

[SOLVED] Creating "readable' VARCHAR


NewbieBryan

Recommended Posts

Hi All,

 

I have created an application that collects information for various people (form submissions) and writes this back to a MySQL db (VARCHAR)

 

All works well but when I read back the "Comments" table then the string is improperly formated, well rather it doesn't remember the formatting.

 

So - for example: If someone typed in:

 

Hello all,

I have the following

A dog,

A Cat

 

when I write it to screen it displays

 

Hello all,I have the following A dog,A Cat

 

Is there a manner in which I can keep the formatting (spaces, etc):

 

Tx

Link to comment
https://forums.phpfreaks.com/topic/165466-solved-creating-readable-varchar/
Share on other sites

Great, tx Ignace,

 

Looking at the raw data in the dB I see that it is displayed naturally (ie: as it was written) but I assume the /n and whatnot are "hidden" when viewing the PhpMyadmin but this is a great start.

 

Next bit;

 

When I pull the data to display I am using the following

 

echo "<tr>";

 

  echo "<td>" . $row['Comment']             . "</td>";

  echo "<td>" . $row['Author'] . "</td>";

 

 

  echo "</tr>";

 

That works great as is; but

 

Can I now be "clever" and insert nl2br in there somewhere?

 

Maybe:

 

. $row[nl2br('Comment')]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.