I've read tons of questions who are in many ways the same as this one. But I just can't seem to understand how I am supposed to do this the proper way.
My approach:
However this way I can't link a portfolio item to more than 1 page. Because UPDATE removes the old information. So I was guessing I needed a way to keep the old info, and add new info if the item is linked to a second page. Can someone push me into the right direction?
Since we have no way of knowing what we are replacing I can only give you an idea of what to do:
UPDATE `table`
SET `myColumn` = CONCAT(`myColumn`, other_data)
WHERE some_condition_exists
This causes the information in myColumn
to have additional data appended to it.
Here's the thing (caveat ahead): If you need one item to be linked to many items what I have described is not the way to go. You should have a table between the two you have already which will allow a one-to-many relationship between pages and portfolios. Please consider refactoring your database design.