I'm creating a restaurant review website. In my comments table I have a foreign key called user_id and idk how can I use it to display the username from the users table
My user table My comment form
So my question is how to display the username? What mysql statements do I have to write. I don't know what to do
Suppose you want to try to get the comment text and username from the corresponding user, you can use a join to combine the information, for example:
I assume the users table is called
users
and the reviews table is calledreviews
, but update those tables as needed, each "aliased" to u and r respectively, and then the table Yes has joined