SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    1. What is the maximum for the data type "Text" in mySQL?
    2. How do I filter out things like html tags?
    Do I use ereg? htmlspecialcharacters?
    3. Actually what should I be concerned about when
    accepting user input when storing data from
    textarea. ( I want to store a comment/description )

  2. #2
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TEXT field:
    AFAIK, there isn't really any practical limit ... I've store 1200-word articles in a TEXT field, and it didn't say nothin'

    Html Tags:
    I can think of two ways of doing this, which are the two ways you mentioned. Either you just have it replace anything in between < >'s with "", so that they vanish without a trace:
    Code:
    ereg_replace("<*>","",$inputdata);
    OR you can use htmlspecialchars, which'll show all the html in the message to the browser as little encoded thingys like &gt; and &lt; tags, etc. This means that the html won't do anything, it'll just look ugly.

    I personally'd recommend using the second option, but only if people our allowed to go back and edit their thingy .. otherwise, they might be stuck with some rather strange html.

    ... what's the world coming to?

  3. #3
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    About the text thing, create a text field in a talbe then goto here:

    http://www.webmasterbase.com/printTemplate.php?aid=228

    And copy the whole text into the database. To make it even larger, you still gotta do html tags, but ignore them, too fudly.

    See if it holds the whole article in the text field.

    It doesn't

    You must create a larger than that big text field to ghet it in.

    Peter

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Regarding amount of text a mysql text field can hold.

    Call me old fashioned - but I tend to consult the manual for these type of things.

    It suggests that
    Code:
    TEXT               2^16 characters = 65536 characters
    MEDIUMTEXT  2^24 characters = 16777216 characters
    LONGTEXT      2^32 characters = 4294967296 characters
    http://www.mysql.com/doc/n/o/node_181.html

  5. #5
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BTW, I just downloaded the bible from http://ebible.org/ and it is 4,256,197 characters long (837,535 words). So you should be able to fit it quite easily into a MEDIUMTEXT field.

  6. #6
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, TEXT is not always the way to go. I once posted a giant Alan Keyes speech transcript and the found that it could not fit! Changing the type worked - you're the man as usual, Sid.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •