davidu Posted February 10, 2013 Share Posted February 10, 2013 (edited) Hi there, I am using MYSQL version 5.1 I need to be able to batch insert possibly many thousand of records into a single table. I want to use PDO and have considered possibly binding the values with bind_param of bind_values. However, surely it would be better for me to build up a string of either 1 or many records with parentheses as elements of an array and then pass to a user defined bulk insert record class. This would then use implode to separate the record with commas. eg. INSERT INTO TABLEA (Col1, Col2 ....) VALUES (record 1), (record 2) ...... What is the essential difference between bind_param of bind_values ? I can't use bind_param or bind values here can I because I would have to loop round the individual recs to bind the recs or can the values from multiple records be bound to the insert cols in 1 pass? Many thanks for your help. Edited February 10, 2013 by davidu Quote Link to comment https://forums.phpfreaks.com/topic/274289-bulkbatch-many-thousands-of-records-into-a-table/ Share on other sites More sharing options...
Barand Posted February 10, 2013 Share Posted February 10, 2013 Fastest way is LOAD DATA command Quote Link to comment https://forums.phpfreaks.com/topic/274289-bulkbatch-many-thousands-of-records-into-a-table/#findComment-1411621 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.