For school, I am working on a project. In this project, I'm trying to create a sort of facebook like idea. You can write on your own profile, you can write on another one profile and you can share those with other people on their profile
I use PHP and Mysql for this.
This first step works perfectly. You can post a message on your own profile, it displays it nicely etc etc. Now I am working on the writes, so I write something on another one's profile. I have a separate layout for them, just something that says PERSONA wrote something on the profile of PERSONB And then here the post
Layout importing isn't that big of a problem, the part where I struggle is how my database should look like.
Right now I have a separate table for the posts, writes, likes, comments, files(for images in the posts)
The problem I have with this setup is when I for example like a post with the id of 7, and also like a write with the id 7, it just won't work cus the likes table is just a table with 5 fields. 1. id Auto increment ID 2. User_id who has liked 3. post_id --> if it is an post, insert the id here
The problem is, when a certain id is given, I don't know if it is meant for a post, a write or whatever.
The best way to solve this should be to have an Auto Increment ID across the
posts
writes
shares
So that an ID only exists in one of the 3, and I can check whatever it is meant to be.
If there are better ways of achieving this(and there probably are better ways) feel free to share it with me!