Can Joomla's DB object add multiple rows at once? MySQL can do this like so:
INSERT INTO x (a,b)
VALUES
('1', 'one'),
('2', 'two'),
('3', 'three')
But can Joomla's own functions achieve the same thing in a single query? Currently I am doing a loop to insert each row (same table) in separate query. Not a good idea when dealing with tons of rows at once.
In your model you can do this:
If you are outside your model you need to get the DB object like so:
You can use:
and
$db->insertId()
can return you autoinc id if you have one.You don't need
$db = $this->getDBO();
just use this:-
Try this:
A description of "values" method
Try this, if you have values in an array :