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.
I've got one table with my pages.
And one table with portfolio items.
I want to be able to say to a portfolio item: You are linked to the welcome page now.
In my pages table i've created a "items_linked" column. Inside this column the id's of the linked portfolio items get stored.
In the html of the 'edit page' I have a select with all my portfolio items, whichever I select gets stored inside the "items_linked".
I use the mysql UPDATE to get the information inside the database.
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?
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.
Asked in February 2016Viewed 3,715 timesVoted 14Answered 1 times