precond
precond

Reputation: 3

Facebook-wall like MySQL Structure problem

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.

So, should I direclty go for my first other solution or there is a better one?

Adv thanks

Upvotes: 0

Views: 721

Answers (2)

Toby Allen
Toby Allen

Reputation: 11213

The solution to your problem would be a standard Database Table.

Use a table with columns

  • PosterId
  • Wall/RecieverId
  • Message
  • Date Posted

This would be a standard database structure. Use the mysql PDO functions to access your data and place in a php array.

Upvotes: 2

Achim
Achim

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

Related Questions