INNER JOIN question - getting the username
Posted: Wed Aug 25, 2010 7:45 am
Hi guys,
I'm trying to get the username out of the user table in accordance to the id in the user table (Which is the same as userid in the blog table). I have the following query so far but I'm not sure how to salvage the username from the users table in order to print it on the page. Could you give me some tips please? Also, is this the best way to do what I'm trying to do?
I'm trying to get the username out of the user table in accordance to the id in the user table (Which is the same as userid in the blog table). I have the following query so far but I'm not sure how to salvage the username from the users table in order to print it on the page. Could you give me some tips please? Also, is this the best way to do what I'm trying to do?
Code: Select all
$query = "SELECT * FROM blog INNER JOIN user ON blog.userid =
user.id WHERE userid='1' ORDER BY thetimestamp DESC";