Submitting more than 8000 textfields

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Submitting more than 8000 textfields

Post by onion2k »

I'm not going to warn or ban anyone in this thread because I'm part of it and I don't want people to accuse me of abusing my mod status to settle arguments. Needlesstosay though, I have brought it to the attention of other mods, and it will be reviewed. Until then stick to the topic at hand without arguing or insulting one another please.
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: Submitting more than 8000 textfields

Post by emmbec »

onion2k wrote:Having a huge number of fields isn't necessarily a problem...
Correct, I echoed the 8200 results and I get them in the other page without any problem (No MySQL Queries executed).
onion2k wrote:...although doing thousands of queries to process the form definitely is a problem...
Yes that was the problem, after some testing I found out that I was performing the 8200 updates, even if the evaluation did not changed, so at first I tried adding in the UPDATE statement a "WHERE n_evaluation!=$MyNewEvaluation" but I still had the problem that I was executing the 8200 updates, soo, what I did is I queried all of the information from the DB and stored it in a PHP variable, and before the update I check if the new value is different to the stored value, if it isn't then I perform the update, otherwise I continue with the rest of the skills. This seems to work even for 11,000 records :D

I know that having the 8200 records is not the best option for usability, and I talked to the people who wanted the application but they want it that way, I will still try to make them change their mind.

Thanks everyone for your help!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Submitting more than 8000 textfields

Post by Christopher »

From reading this post, it sounds like they really want a web page that acts like a spreadsheet. You might want to rethink the whole form idea and move to edit-in-place using a Javascript library. That way you display all the data with one SELECT. Then you only do UPDATEs and INSERTs on the cells/rows they are actually working on. You would have fewer net database queries and they would be more spread out over time. And you'd have a much cooler interface. I recently used jQuery to do edit-in-place and it was very easy to implement.
(#10850)
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Re: Submitting more than 8000 textfields

Post by emmbec »

arborint wrote:You might want to rethink the whole form idea and move to edit-in-place using a Javascript library.
I have not used JQuery, I'm going to google it and see how to implement it. Thanks!
Post Reply