Welcome Guest, Not a member yet? Register   Sign In
Inserting post data into joining table, any help!
#2

[eluser]jakelehner[/eluser]
Looping in the DB is likely not the best approach. Build the insert logic in to your PHP then send to the DB.

You can either do a single query:

Code:
INSERT INTO prod_cat
('product_id', 'category_id')
VALUES
(1,4),
(1,6),
(1,7),
(1,34)

That will insert 4 records in one query. I'm not sure how that would work with Active Record.

Alternatively, wrap multiple DB calls in a transaction so you can roll back if something fails.


Messages In This Thread
Inserting post data into joining table, any help! - by El Forum - 08-07-2012, 09:50 AM
Inserting post data into joining table, any help! - by El Forum - 08-07-2012, 12:17 PM
Inserting post data into joining table, any help! - by El Forum - 08-08-2012, 06:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB