Computer Talk Discussions here pertain to mods, troubleshooting, and PC/console gaming

is there a limit on how many characters you can pass to the query string?

Old 11-01-2004, 10:14 AM
  #1  
Senior Member
Thread Starter
 
jacksonpt's Avatar
 
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.
Old 11-01-2004, 11:31 AM
  #2  
Registered User
 
Churnd's Avatar
 
Join Date: Jan 2003
Location: Hattiesburg, MS
Posts: 4,087
Likes: 0
Received 1 Like on 1 Post
Be more specific...
Old 11-01-2004, 11:37 AM
  #3  
Senior Member
Thread Starter
 
jacksonpt's Avatar
 
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...
I'm working on a database that manages all of the majors offered at the university where I work. I have form that allows staff members to add majors to the database as necessary. The form deals with one record at a time, each text input field represents one field in that record. The form handles 14 of the 15 fields for each record. One field is fairly large... up to a few hundred words (it's a description field).

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?
Old 11-01-2004, 12:23 PM
  #4  
Registered User
 
midiwall's Avatar
 
Join Date: Dec 2002
Location: Seattleish, WA
Posts: 9,048
Likes: 0
Received 2 Likes on 2 Posts
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.
Old 11-02-2004, 04:49 AM
  #5  
Senior Member
Thread Starter
 
jacksonpt's Avatar
 
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.
Old 11-02-2004, 06:35 AM
  #6  
Registered User
 
midiwall's Avatar
 
Join Date: Dec 2002
Location: Seattleish, WA
Posts: 9,048
Likes: 0
Received 2 Likes on 2 Posts
'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.
Old 11-02-2004, 08:51 AM
  #7  
Senior Member
Thread Starter
 
jacksonpt's Avatar
 
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....
Old 11-02-2004, 09:50 AM
  #8  
Registered User
 
midiwall's Avatar
 
Join Date: Dec 2002
Location: Seattleish, WA
Posts: 9,048
Likes: 0
Received 2 Likes on 2 Posts
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.
_OH_... then I misread this:

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.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
primordialbeast117
86-95 Trucks & 4Runners
11
12-19-2015 12:23 PM
Jdgarrison
Newbie Tech Section
0
10-01-2015 02:11 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
taraf
Pre 84 Trucks
2
09-25-2015 02:57 PM


Thread Tools
Search this Thread
Quick Reply: is there a limit on how many characters you can pass to the query string?



All times are GMT -8. The time now is 10:39 AM.