Reputation: 15
I have created a database like this
+----------------+------------------+
| name | password |
+----------------+------------------+
| john | ******** |
+----------------+------------------+
| james | &*^^%^ |
+----------------+------------------+
Is there any way to create a new table row by column friend,messages, and message from for john and james and other those who join my site?
Upvotes: 0
Views: 4570
Reputation: 5128
you would need consider your database design to include those features. you'll need to add new tables that have a relation to your usertable. Before starting this I would suggest you learn a bit more about relational database design, if you dont you'll get in trouble later on and will need to start it all over.
take a look here, looked like a decent tutorial.
Upvotes: 0
Reputation: 39773
You could add those columns to your table, but putting that kind of information in the user table is a bad idea.
You should create new tables and use a JOIN to fetch the data:
First, add an ID column to your existing table.
|----------------|------------------|------------------|
| ID | user | password |
|----------------|------------------|------------------|
Then, create a new table with the wanted columns:
Table friends:
Table messages
Upvotes: 4
Reputation: 7887
http://dev.mysql.com/doc/refman/5.1/de/alter-table.html
ALTER TABLE your_table
ADD COLUMN friends TYPE NULL;
Upvotes: 0