So here’s the desired thing i’d like to do. I have two tables in sql
I’d like to echo out all the messages and the username of the message sender.
here’s how the tables are set up.
table name: user
user_id user_name
1 abc
2 bob
3 pqr
table2 name : message
intro_id user_id msg
1 4 abc
2 4 jkl
3 2 cbd
desired output would be like this
new abc
new jkl
bob cbd
My code so far only outputs the messages
$result = mysql_query("SELECT * FROM message");
while($row = mysql_fetch_array($result))
{
echo $row['msg'] ;
}
Try this query to obtain the user_name