I have an array with 30000 plus entries that need to go into a MySQL table.
What is the best practice? From here? Lets say ,  and  in the database would be 'title', 'type' and 'customer'
Is it add key names matching the column names in the table and call som "magic" function? Or build the query manually...
Array (  => Array (  => 2140395946  => 1SAP  => 0041451463 )  => Array (  => 2140411607  => 2SAP  => 0041411940 )  => Array (  => 2140706194  => 4SAP  => 0041411943 ) etc. etc.
UPDATE - based on answers
Thanks for the answers.
The solution would normally be to manually create the SQL-string and all rows can be inserted as one:
INSERT INTO `tx_opengate_table` (`machine` ,`customer` ,`type`) VALUES ('m123', 'dfkj45', 'A'), ('m137', 'kfkj49', 'A'), "repeat this line for each entry in the array" ... ... ... ('m654321', '34dgf456', 'C4') "end with out comma, or remove last comma" ;
Special for TYPO3
I happen to do this in the CMS TYPO3 and just came across a new function added not that long ago:
//Insert new rows $table = 'tx_opengate_stuff'; $fields = array('machine','type','customer'); $lines = "array as given above" $GLOBALS['TYPO3_DB']->exec_INSERTmultipleRows($table,$fields,$lines);
I would say just build it yourself. You can set it up like this:
Don't forget to escape quotes if it's necessary.
Also, be careful that there's not too much data being sent at once. You may have to execute it in chunks instead of all at once.