SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Why I can't limit the length of TEXT type in phpmyadmin?

    Hi guys,

    Why I can't limit the length of TEXT type in phpmyadmin?
    Is this a bug?

    I entered like this,

    type: TEXT
    length/values: 5000

    and also I tried like this,
    type: TEXT
    length/values: 5,000

    When I view the structure of the table it shows like this,
    Code:
    text
    Isn't it suppose to be look like this?,
    Code:
    text(5000)
    Can someone explain please.
    I Love coding...
    Don't click this link.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    those numbers in parentheses behind some datatypes might be making you think that they somehow "limit" the number of characters or digits that the column can hold

    this is ~not~ what they do for integer datatypes

    INT(4) and INT(10) and INT(937) will all hold exactly the same range of numbers

    the numbers in parentheses behind CHAR and VARCHAR are required and ~do~ limit the length of the values

    numbers in parentheses behind TEXT and BLOB and their similar datatypes are not permitted
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    @r937 ;
    It's really nice to hear the answer from a master.
    Thanks again master.
    I Love coding...
    Don't click this link.

  4. #4
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    By the way, so what is the use of the integer length?
    Code:
    INT(4) and INT(10) and INT(937)
    I Love coding...
    Don't click this link.

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by solidcodes View Post
    By the way, so what is the use of the integer length?
    Code:
    INT(4) and INT(10) and INT(937)
    If you use it with a padding option then the number gets padded out to the specified length if it is shorter. If you don't use it with a padding option then it makes no difference at all.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by felgall View Post
    If you use it with a padding option ...
    specifically, ZEROFILL
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys.
    I Love coding...
    Don't click this link.


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
  •