farazch Posted March 9, 2015 Share Posted March 9, 2015 I am reading data from CVS file and then inserting them with bulk insert query in MYSQL DB because i have rows in 10 thousands. The problem i am facing is, whenver i do bulk insert using PHP , it only insert 136 rows. This number of rows insertion remains same whatever the size of CSV rows are. I increased the values of max_execution_time , memory_limit using php_ini as well as from .htaccess but to no avail. I understand there is some setting which is causing insertion of only fixed number of rows but unable to find exact parament. Anyone can help me out what i need to do for bulk insertion in mysql DB using PHP when isertion rows are in ten thousand or 15 thousands. Quote Link to comment https://forums.phpfreaks.com/topic/295191-large-bulk-insertion-in-mysql-problem/ Share on other sites More sharing options...
mac_gyver Posted March 9, 2015 Share Posted March 9, 2015 it's likely that you are getting a query error at the 137th line in the csv file, either due to an un-escaped value in the data, a duplicate key error, an empty numerical data value, an incorrectly formatted line in the data, or ... does your code have any sort of error checking logic in it to detect query errors? have you looked at the 137th line of data to see if there's something about it that's different and unexpected? edit: here's a post listing methods for inserting bulk data - http://forums.phpfreaks.com/topic/294621-importing-legacy-data-into-mysql/?do=findComment&comment=1505730 Quote Link to comment https://forums.phpfreaks.com/topic/295191-large-bulk-insertion-in-mysql-problem/#findComment-1507938 Share on other sites More sharing options...
farazch Posted March 9, 2015 Author Share Posted March 9, 2015 Thanks for the reply. Yes there is error checking login in my code and there is no error on line 137th. I tried different CSV files and it shows the same behaviour ie insert only 136 lines. Quote Link to comment https://forums.phpfreaks.com/topic/295191-large-bulk-insertion-in-mysql-problem/#findComment-1507941 Share on other sites More sharing options...
Psycho Posted March 9, 2015 Share Posted March 9, 2015 Can you post the contents of the CSV file from lines ~130 to ~140? Where are these CSV files generated from. You state there is no error, but simple things (missing comma for instance) can easily be missed. If these files are all coming from the same source process, there could be an error in that. Quote Link to comment https://forums.phpfreaks.com/topic/295191-large-bulk-insertion-in-mysql-problem/#findComment-1507942 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.