Welcome Guest, Not a member yet? Register   Sign In
How to handle Large no of inputs
#1

I have a form with dynamic number of inputs and it could reach up to 100k input fields. When I submit the form it is taking way to long to process and insert into database. Is there any way to make this process faster. I am using PHP (Codeignite 3) as programming language and mysql as database. Also when the form is in process of submitting all other pages will not load either. 
Its a software with inventory and POS and and when they buy the product I have to keep track of the product by serial no which is unique for each product. When they buy product sometimes its in tens of thousands in quantities so it requires all the fields.
It has a serial number auto generator which takes starting serial number and quantity and generates that number of serial numbers. eg. if I have 10 products coming with 3 having sn01-sn03, mn01-mn04 and ss01-ss-03. I would provide relative data like starting number sn01 and quantity 3 and it will generate that . and you don't need to scan/enter every item since the package cartoon box comes with the starting no and no of item in it. and since they might have some mismatch as well so I need all the input for that.
I need to send all the serial numbers which can amount to thousands of input fields. and when submitting the form it takes to long to insert in database and if I have any other active pages and wants to navigate to other pages, it will not, it waits for the process to be complete. I am using xampp. input fields can amount to 100k input fields
Stackoverflow link: php - How to handle Large no of inputs - Stack Overflow

Thanks for the help in advance...
Reply
#2

Initial thoughts, 100K input fields sounds like a very very bad idea.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#3

For this kind of high volume things you can get benefit of php fpm or road runner etc. Keep your data tables INNODB not MYISAM.

But still your project design looks incorrect. I believe that you should redesign it. Or give us more detail with a real example so that we can help you better to design it.
Reply
#4

(This post was last modified: 04-04-2022, 01:04 PM by luckmoshy.)

I think you are asking for 100 form users simultaneously is it?????
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#5

(This post was last modified: 04-04-2022, 11:25 PM by lazyme114.)

Example in form
PHP Code:
for($i 1$i <= 100000$i++) {
    echo "<input type='hidden' name='serial_no[]' value='sn_{rand(10, 1000000)}' >";


in modal
PHP Code:
foreach($_POST['serial_no'] as $sn) {
  $data = array(some required data);
  $data['serial_no'] = $sn;
  $this->db->insert("table_name"$data);



I have updated the question in stackoverflow. Feel free to look at it.
Reply
#6

If you have that many form inputs then I would be rethinking my application.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

I only need to reduce the time taken to store in the database, the application is fine as it is. if the input fields are what making the issue, will autogenerating the serial number and inserting the data in the database 1000000 times take less times the inputing from the form? I don't think the impact will differ that much. I haven't face that kind of problems before so I don't know much about it. Plz help..
Reply
#8

It seems that I only need to change the insert query to insert_batch it reduced the time significantly. Thanks for all your suggestions anyway.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB