Results 1 to 3 of 3

Thread: MySQL - only 255 char ?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2006
    Location
    Czech Republic
    Posts
    52

    MySQL - only 255 char ?

    I want to make chat or forum. Can you help me ? In database is only 255 characters. It's right ? I need more character in my database. How you make your databases (chat or forum ...) ?

  2. #2
    Hyperactive Member ..:RUDI:..'s Avatar
    Join Date
    Aug 2005
    Location
    Yorkshire, England! c0d: Da Vinci
    Posts
    344

    Re: MySQL - only 255 char ?

    Fields in tables can generally be whatever length you want, sometimes depending on the table type that you choose. I use InnoDB and for the posts, just specify the type as text, then unlimited...

    This is a snippet from the install code of MageBB for creating the tables.
    PHP Code:
    $sql0="CREATE TABLE posts (
    post text NOT NULL,
    TYPE=InnoDB ;"

    That can have unlimited characters for the posts

    Rudi



    My Personal Home | MageBB Home | Elders Online
    Yes, Noteme is my father.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: MySQL - only 255 char ?

    The way in which databases store their data means that character fields have a maximum length of 255 characters. The reason for this, is to make queries on the table faster. Variable length character fields often impose the same limit.

    If you need to store large amounts of data in a specific field, you need to use binary large obects (BLOB)'s these allow you to srote up to 4GB of variable length data in each field.

    Databases often store BLOB data in a separate file; again to make queries on the data faster.

    As stated above by RUDI you need to set the datatype as BLOB or TEXT when you create the table. Have a look here for some more information: http://dev.mysql.com/doc/refman/5.0/en/blob.html
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width