Reputation: 2000
I have fetched the data from two different tables is this. But now, I want the following result with their original names and not the numbers like status 1 is for Good, and user_id=1 means "Mike".
Upvotes: 0
Views: 59
Reputation: 79939
Just JOIN
your tables, something like:
SELECT f.FollowDate, s.StatusName, u.UserName
FROM Folowers f
INNER JOIN Users u ON f.UserId = u.ID
INNER JOIN Statuses s ON f.StatusID = s.ID
Upvotes: 0
Reputation: 4849
To select usernames using userID try using an inner join
And/or you can say 1 = good like so:
if($status == 1)
{
echo "Good";
}
(though this can also be done with the inner join, if you have the values in another table ofcourse)
Upvotes: 2