is there a limit on how many characters you can pass to the query string?
#1
Senior Member
Thread Starter
Join Date: May 2002
Location: Binghamton, NY
Posts: 2,752
Likes: 0
Received 0 Likes
on
0 Posts
is there a limit on how many characters you can pass to the query string?
subject says it all... I have a form that seems to work or not work depending on how many characters it has to pass to the querystring.
#3
Senior Member
Thread Starter
Join Date: May 2002
Location: Binghamton, NY
Posts: 2,752
Likes: 0
Received 0 Likes
on
0 Posts
Originally Posted by Churnd
Be more specific...
So here's what happens...
I fill out the form to add a record to the database. I clck submit and nothing happens. **from here on out, I'm testing to find out what's wrong** I clear the form, fill in the first field, click submit, record is added just fine. Same thing for the second field, third field, and so on.
Eventually I'll get far enough through the form so that when I fill in the text box and hit submit, nothing happens (same thing that happened when I filled out the form initially). So I clear that field, hit submit, and everything works fine again.
I enter 1 character in the field, hit submit, and it works. I do it again, this time with 2 characters, and everything works. Next time I do 3 characters... and so on.
Eventually I'll get to the point where adding the one additional character causes the form to stop working. The problem is, I'm not sure WHY it's not working.
Could the querystring only handle so many characters? When things don't work correctly, nothing is being sent to the querystring.
Does that help at all?
#4
Registered User
It helps a bit...
You'll need to share more info about how the form submit is being handled - do you have a perl, php, etc. script that's parsing the fields and then stuffing them into a SQL insert? Or is this Cold Fusion or some other CGI front-end to SQL? Do you have control over the intermediate script that's handling the data?
What's the database schema look like? Do you have control over it?
In short, it looks like (as you suspect) when you get to a point that the form field length is larger than the database column definition, the insert is failing.
One thing to do would be to add some error handling on the insert. Or, better yet, add some field validation up-front so that you don't try the insert without knowing that the form length is <= the column definition in the table.
You'll need to share more info about how the form submit is being handled - do you have a perl, php, etc. script that's parsing the fields and then stuffing them into a SQL insert? Or is this Cold Fusion or some other CGI front-end to SQL? Do you have control over the intermediate script that's handling the data?
What's the database schema look like? Do you have control over it?
In short, it looks like (as you suspect) when you get to a point that the form field length is larger than the database column definition, the insert is failing.
One thing to do would be to add some error handling on the insert. Or, better yet, add some field validation up-front so that you don't try the insert without knowing that the form length is <= the column definition in the table.
#5
Senior Member
Thread Starter
Join Date: May 2002
Location: Binghamton, NY
Posts: 2,752
Likes: 0
Received 0 Likes
on
0 Posts
ok...
It's a web form backed by php. The data is pushed to a MySQL db via php/SQL. When the form doesn't work, the querystring is empty - so I don't think the SQL is ever called, sot he insert never runs. I think the problem is "before" the insert statement, which is why I asked about the querystring.
I have total control over all parts of this project, so I can change whatever is necessary.
It's a web form backed by php. The data is pushed to a MySQL db via php/SQL. When the form doesn't work, the querystring is empty - so I don't think the SQL is ever called, sot he insert never runs. I think the problem is "before" the insert statement, which is why I asked about the querystring.
I have total control over all parts of this project, so I can change whatever is necessary.
#6
Registered User
'k... so it sounds like there may be validation happening before the insert's fired. The validation would be checking the entered string length against the size of the column, and knowing that the entered string is longer than the column, it's not attempting the insert.
To verify this, check the column length definition. Given that length as n, then enter n-1 characters into the field and see if it goes (I'm thinking it will); then try n, and n+1. If n-1 & n work, but n+1 doesn't, then start digging through the php code looking for someone checking the lengths.
This actually sounds liek the code is doing what it should - not trying the insert. It just needs some error handling to let the user know what's going on.
To verify this, check the column length definition. Given that length as n, then enter n-1 characters into the field and see if it goes (I'm thinking it will); then try n, and n+1. If n-1 & n work, but n+1 doesn't, then start digging through the php code looking for someone checking the lengths.
This actually sounds liek the code is doing what it should - not trying the insert. It just needs some error handling to let the user know what's going on.
#7
Senior Member
Thread Starter
Join Date: May 2002
Location: Binghamton, NY
Posts: 2,752
Likes: 0
Received 0 Likes
on
0 Posts
OK... looks like it's a GET versus POST thing in the form itself.
I know it does NOT have to do with field length. Sometimes 10 characters in the field causes problems, sometimes 50 characters works. I really think it has to do with the total number of characters being passed to the querystring.
Still working on it though, so....
I know it does NOT have to do with field length. Sometimes 10 characters in the field causes problems, sometimes 50 characters works. I really think it has to do with the total number of characters being passed to the querystring.
Still working on it though, so....
Trending Topics
#8
Registered User
Originally Posted by jacksonpt
I know it does NOT have to do with field length. Sometimes 10 characters in the field causes problems, sometimes 50 characters works. I really think it has to do with the total number of characters being passed to the querystring.
Eventually I'll get far enough through the form so that when I fill in the text box and hit submit, nothing happens (same thing that happened when I filled out the form initially). So I clear that field, hit submit, and everything works fine again.
Okay... No, I don't know of a (practical) limit on the length of QueryString. Architecturally, that string lives in the PHP world and is passed by reference into MySQL, so while it may have a practical size limit, it'll be something obnoxious like the size of your stack (1meg in a Windows platform).
You say that the QS is empty when this fails, so it's not even getting built. Start tossing debug statements in there from the point of mysqlQuery() on back... At some point you'll find where the QS is being built and where things are going south.
Thread
Thread Starter
Forum
Replies
Last Post
primordialbeast117
86-95 Trucks & 4Runners
11
12-19-2015 12:23 PM
charlie_fong
General Vehicle Related Topics (Non Year Related)
0
09-27-2015 10:06 PM
Toys4parts
86-95 Trucks & 4Runners (Build-Up Section)
2
09-26-2015 01:56 PM