-1

I have a database with users. Now I'm trying to create a wall (Facebook like). I've added a table in my db called status_update and added a row username(user who posted the status). Then I created a query to search for statuses from the user on whose profile page you're on (select from status where username=$_GET['profile']).

I'm wondering how smart this is? Is there a way to use JOIN or something? Now this was the only logic solution that came to my mind and I know how to make it.

Also this is fine for this page but when I'll create a feed page for those who are "Friends or Followers" that's gonna be a bit tricky.

Is there a better solution for this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Studio DnB
  • 19
  • 9

1 Answers1

0

yes you can join two tables by there index or any value, just do it like this

select * from table1 inner join table2 on table.field=table.field

it depends what join you want, inner join if data present on both table other wise left if data may or may not present

Waleed Ahmed Haris
  • 1,229
  • 11
  • 17
  • So if I do it like select * from status inner join user on status.username=user.username? Will I get information from table status where usernames are the same? Sorry would test it but not home ATM. – Studio DnB May 08 '16 at 11:26