The major difference between TEXT and LONGTEXT data types is the size (65k
vs 4Meg).

The function addslashes() will resolve many user input problems where the
user;

Inputs a quoted value in the middle of his string.
Uses & and < and > in text.
Inputs other ASCII control characters like tab and bell (remember that one).

Just to name a few.

Usually MySQL will strip slashes when the column is retrieved, however care
should be taken when displaying the value on a form (inside another text
area should be no problem).  Suppose a user codes the following
"<b>TEST</b>" to be stored in your database, you have to decide if you want
that displayed on a web page as bold text or exactly as input.  If you want
it to appear exactly as the user typed it in, check out the
htmlspecialchars() function.

Hope this helps,

Warren Vail
 


-----Original Message-----
From: Ron Stiemer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 15, 2004 12:26 PM
To: 'php-gen'
Subject: AW: [PHP] Storing text with carriage returns in MySQL


Hi Andrew,

I'm also saving html input from textarea fields into my msql DB...but try to
use the filed type TEXT instead of LONGTEXT that it should work fine.

Greetings,
Ron 

-----Ursprüngliche Nachricht-----
Von: Andrew Wood [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 15. Juli 2004 21:19
An: php-gen
Betreff: [PHP] Storing text with carriage returns in MySQL

I'm trying to use PHP to read text from an HTML textarea form field and
store in in MySQL using the longtext data type but it's cutting off
everything after the first carriage return.  I suspect I need to iterate
through the text looking for CRs then do something?  But I don't know what.

Can anyone offer any pointers?

Thanks

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to