Forum Moderators: coopster & phranque

Message Too Old, No Replies

Long Text From Textarea to Mysql

Long Text From Textarea to Mysql

         

pavelcz

7:49 pm on Nov 6, 2002 (gmt 0)

10+ Year Member



Hello experts,
How can I send a longer text from TEXTAREA to MySQL? I can send short text but long text does not work. When I send the same long text by using PHPMyAdmin it works fine...
I suppose that I send the long text as a part of URL (and URL is too long) but how it is done in PHPMyAdmin?
I use Linux, Apache, PHP, MySQL
Many thanks, Pavel

lorax

7:58 pm on Nov 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Greetings Pavelcz and welcome to WebmasterWorld.

What's the field type of the MySQL field? If it's text then you can put up to 65535 characters into it without a problem.

If the string is short enough, it may be that your using an illegal character like a ' or /. These need to be escaped by adding an addslashes() to the var that you're submitting.

pavelcz

8:36 pm on Nov 6, 2002 (gmt 0)

10+ Year Member



lorax,
I use TEXT type. I tried to insert clear string without any illegal characters and it is the same. I have found out that I can insert text max 4KB length. If the text is longer, I have got msg from server

Request-URI Too Large
The requested URL's length exceeds the capacity limit for this server.
request failed: URI too long

But as I mentioned in my previos msg - from PHPMySQL it works fine.
Many thanks, Pavel

dingman

8:40 pm on Nov 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Pavel - if the error you are getting is that the URL is too long, try using the "post" form submission method instead of "get". It's no harder to process than a "get" request, and it's much more appropriate than cramming the large data fields into the URL (which is how "get" works).

pavelcz

9:18 pm on Nov 6, 2002 (gmt 0)

10+ Year Member



dingman, OK now!
Thanks to your remark about POST method I checked again my script - there was missing send method. And GET has probably higher priority the POST.
Again - thanks, Pavel

andreasfriedrich

11:04 pm on Nov 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And GET has probably higher priority the POST

The HTML specs [w3.org] define GET as the default method [w3.org] to submit forms.