I would like to insert more than one array of values at once.
How do I do that with the current documentation. It shows me how to insert one with
db::insert('comments', array(
'name' => 'Bastian',
'email' => 'bastian@getkirby.com'
'comment' => 'This is my first comment',
'date' => 'NOW()',
));
but I have like 800 of these that need to go in and I can’t loop this insert and make a call to the database each time. I just want to send all values at once.
Also, I can’t use the Complex queries because it expects something to be returned and throws a 2053 error.
What’s your use case? If this is data you already have, rather then data you are capturing (which is what the example you posted is for, I believe) wouldn’t a SQL Script be easier, or a CSV import using something like SqlPro?
Every minute I need to pull down XML data loop through it and store the 800 values to a database all in one call.
Hmmm. You could use just ordinary PHP, something like this i think (Scroll to Inserting Multiple Rows), but tweaked to use the database connection you already have.
There are classes for this, I’m just not seeing how to insert multiple values all at once. @texnixe
Thats a limitation (more like a security feature) of PDO. You can only execute one sql call at a time. If you need to perform multiple calls concurrently you need to use a transaction to do so.
This is nothing that is covered by the toolkit class though.
Have a look here or here.
If you really can’t loop through your inserts you will probably need to leverage mysql_query()
like @jimbobrjames suggested.