I am trying to post a blog into mysql table though php into mysql table.
The blog content is very large (like 2000 characters) and I have given mysql column Data Type TEXT
. So, when I upload using HTML from, nothing is shown on upload.php
. But when I minimize the blog content to 1000 Characters, Blog get posted. This happened to me several times, why this is happening? Any help?

- 3
- 1
-
ADD mysql_real_escape_string($text); before inserting – Florin Jan 25 '14 at 07:26
2 Answers
The following are the character lengths for each respective data type:
CHAR( ) A fixed section from 0 to 255 characters long.
VARCHAR( ) A variable section from 0 to 255 characters long.
TINYTEXT A string with a maximum length of 255 characters.
TEXT A string with a maximum length of 65535 characters.
BLOB A string with a maximum length of 65535 characters.
MEDIUMTEXT A string with a maximum length of 16777215 characters.
MEDIUMBLOB A string with a maximum length of 16777215 characters.
LONGTEXT A string with a maximum length of 4294967295 characters.
LONGBLOB A string with a maximum length of 4294967295 characters.
You could try using a larger data type however that does not appear to be the issue. Check for any errors in your php error log to ensure you're not running out of memory when posting this and that no MySQL errors are occuring.

- 2,307
- 6
- 19
- 31
You'd need to give us more information than that. Please check your PHP error logs. On Apache these are normally located at /var/log/apache2/error.log
, or you can use the function ini_set('display_errors', 'true');
at the top of your code.
What could be happening could be that your php.ini is set to only allow so many characters in a POST message, or your MySQL is treating TEXT columns strangely as they should be able to hold 65,535 bytes
(assuming each character is a byte, around 65,535 characters). You can try setting your MySQL column to a MEDIUMTEXT
field and see if that resolves the issue. If it doesn't it's likely a PHP or web server problem.
If it isn't MySQL you'd then need to search through php.ini
and your web server configuration for any problems. A different question What is the size limit of a post request? had an answer which explained that you can override the maximum post size in Apache simply by editing your .htaccess

- 1
- 1

- 1,324
- 13
- 27