在将产品列入电子店时,我们常常需要将一些产品(与工厂有关的产品)与其他产品联系起来,而且连接必须同时进行,即如果我把产品1与产品2联系起来,那么产品2也必须与产品1挂钩。
采用额外的表格关系(prodid, 相关_prodid)或将相关产品清单列入产品表中每一产品行经限定的插图,是哪些最佳做法?
In either case, we would also need a recursive method to loop through a given array of products and insert/update the tables with the relations, could someone help me out with the algorithm? I will do the PHP coding but I cant think of a good way to do it.