Reputation: 3
I don’t want any code just a how-to answer.
I’m trying to add a facebook-wall-like feature to a webapp (not commercial, only experimental).
The first thing I thought about was to store something like “1/2011-10-10/texthere,2/2011-10-10/texthere” where 1 would be the id & 2011-10-10 the date. Then I would explode it in php and have an array. (Then search for each id in the users table etc…)
But this has some problems. One would be if I have too many posts, it will be extremely heavy to a webpage and very difficult to limit results (without talking about character restriction for the array’s sake).
So I thought about two other solutions that have the pros and cons for me.
Use one table with 4 columns: Poster id, Receiver id, Message, Date Posted
One table for each user (desperate solution :))
So, should I direclty go for my first other solution or there is a better one?
Adv thanks
Upvotes: 0
Views: 721
Reputation: 11213
The solution to your problem would be a standard Database Table.
Use a table with columns
This would be a standard database structure. Use the mysql PDO functions to access your data and place in a php array.
Upvotes: 2
Reputation: 15702
One table per user is a bad idea. Storing different values in different columns is what databases are made for. So it's probably a much better idea! ;-)
Upvotes: 5