Jump to content

Recommended Posts

What is the best field type to use if im looking at around 10,000 characters as the maximum, this is too high for varchar which limits me at 255, so i used blob instead but in phpmyadmin it only allows me to upload a file, so i uploaded a word document and it became all strange with extra symbols in it. What field type should i use for 10,000 characters?

Link to comment
https://forums.phpfreaks.com/topic/129203-solved-best-field-type-to-use/
Share on other sites

BLOB = Binary Large Object. So that is why it wants a file uploaded. For Text, you want to use one of the following (the number after it is the max characters):

 

VARCHAR - 255

TINYTEXT - 256

TEXT - 65,536

MEDIUMTEXT - 16,777,216

LONGTEXT - 4,294,967,296

 

that being said, you should be safe with TEXT

 

EDIT: for those interested in how i got those numbers, it's on this page: http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html scroll down to "Storage Requirements for String Types". You will have to do the math (aka 2^16 = 65,536)

my webhost is running

localhost

 

    * Server version: 4.1.22-standard

    * Protocol version: 10

    * Server: Localhost via UNIX socket

    * User: a6474246@localhost

    * MySQL charset: UTF-8 Unicode (utf8)

    *

      MySQL connection collation: armscii8_binarmscii8_general_ciascii_binascii_general_cibig5_binbig5_chinese_cibinarycp1250_bincp1250_croatian_cicp1250_czech_cscp1250_general_cicp1251_bincp1251_bulgarian_cicp1251_general_cicp1251_general_cscp1251_ukrainian_cicp1256_bincp1256_general_cicp1257_bincp1257_general_cicp1257_lithuanian_cicp850_bincp850_general_cicp852_bincp852_general_cicp866_bincp866_general_cicp932_bincp932_japanese_cidec8_bindec8_swedish_cieuckr_bineuckr_korean_cigb2312_bingb2312_chinese_cigbk_bingbk_chinese_cigeostd8_bingeostd8_general_cigreek_bingreek_general_cihebrew_binhebrew_general_cihp8_binhp8_english_cikeybcs2_binkeybcs2_general_cikoi8r_binkoi8r_general_cikoi8u_binkoi8u_general_cilatin1_binlatin1_danish_cilatin1_general_cilatin1_general_cslatin1_german1_cilatin1_german2_cilatin1_spanish_cilatin1_swedish_cilatin2_binlatin2_croatian_cilatin2_czech_cslatin2_general_cilatin2_hungarian_cilatin5_binlatin5_turkish_cilatin7_binlatin7_estonian_cslatin7_general_cilatin7_general_csmacce_binmacce_general_cimacroman_binmacroman_general_cisjis_binsjis_japanese_ciswe7_binswe7_swedish_citis620_bintis620_thai_ciucs2_binucs2_czech_ciucs2_danish_ciucs2_estonian_ciucs2_general_ciucs2_icelandic_ciucs2_latvian_ciucs2_lithuanian_ciucs2_persian_ciucs2_polish_ciucs2_roman_ciucs2_romanian_ciucs2_slovak_ciucs2_slovenian_ciucs2_spanish2_ciucs2_spanish_ciucs2_swedish_ciucs2_turkish_ciucs2_unicode_ciujis_binujis_japanese_ciutf8_binutf8_czech_ciutf8_danish_ciutf8_estonian_ciutf8_general_ciutf8_icelandic_ciutf8_latvian_ciutf8_lithuanian_ciutf8_persian_ciutf8_polish_ciutf8_roman_ciutf8_romanian_ciutf8_slovak_ciutf8_slovenian_ciutf8_spanish2_ciutf8_spanish_ciutf8_swedish_ciutf8_turkish_ciutf8_unicode_ci Documentation

    * Create new database: Documentation

      No Privileges

    * Show MySQL runtime information

    * Show MySQL system variables Documentation

    * Processes Documentation

    * Character Sets and Collations

    * Storage Engines

    * Databases

    * Export

    * Import

    * Log out Info

 

phpMyAdmin - 2.11.4

 

    * MySQL client version: 4.1.22

    * Used PHP extensions: mysql

    *

      Language Info:

    *

      Theme / Style:

    *

      Font size:

    * phpMyAdmin documentation

    * phpMyAdmin wiki

    * Official phpMyAdmin Homepage

    * [ChangeLog] [subversion] [Lists]

 

 

so i think ill use text

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.