El Forum
08-08-2012, 11:46 AM
[eluser]ppwalks[/eluser]
I have a joining table to link products to categories, but when I insert the data it is only updationg the first value. I have purposely made a table column error to display what the statement is that is going through. I am trying to do a batch update so it will insert multiple entries. ie. product_id 1 can be with cat_id 4,6, 2:
product_id 1 -> cat_id 5
product_id 1 -> cat_is 3
product_id 1 -> cat_is 2
and so on..
This has been driving me mad today and is the last part of the puzzle..
Please someone enlighten me.
here is the insert (remeber product_id is spelt wrong to show insert)
It is only inserting product_id 102 and cat_id 1 but not product_id 102 and cat_id 5, can someone help again?
Thanks
I have a joining table to link products to categories, but when I insert the data it is only updationg the first value. I have purposely made a table column error to display what the statement is that is going through. I am trying to do a batch update so it will insert multiple entries. ie. product_id 1 can be with cat_id 4,6, 2:
product_id 1 -> cat_id 5
product_id 1 -> cat_is 3
product_id 1 -> cat_is 2
and so on..
This has been driving me mad today and is the last part of the puzzle..
Please someone enlighten me.
here is the insert (remeber product_id is spelt wrong to show insert)
Code:
INSERT INTO `product_category` (`prduct_id`, `category_id`) VALUES ('102,102', '1,5')
It is only inserting product_id 102 and cat_id 1 but not product_id 102 and cat_id 5, can someone help again?
Thanks