3raser Posted April 3, 2011 Share Posted April 3, 2011 Here is the original query: $query_extract = mysql_query("SELECT downloads,date,title,username,views,id FROM skins ORDER BY id DESC LIMIT 100"); Is it possible to also grab the row username from the table users, without making multiple queries? Link to comment https://forums.phpfreaks.com/topic/232591-joined-queries/ Share on other sites More sharing options...
Zurev Posted April 3, 2011 Share Posted April 3, 2011 Give this a shot: SELECT s.downloads,s.date,s.title,s.username,s.views,s.id FROM skins s, users u WHERE s.username = u.username ORDER BY s.id DESC LIMIT 100 Dusty on my SQL, may not work... Link to comment https://forums.phpfreaks.com/topic/232591-joined-queries/#findComment-1196347 Share on other sites More sharing options...
3raser Posted April 3, 2011 Author Share Posted April 3, 2011 I tried this: $query_extract = mysql_query("SELECT s.downloads,s.date,s.title,s.username,s.views,s.id,u.status,u.username FROM skins s, users u WHERE s.username = u.username ORDER BY s.id DESC LIMIT 100"); while($row = mysql_fetch_assoc($query_extract)) { if($row['u.status'] == 1) $row['s.username'] = "dgjldfgjdflg"; echo "<tr><td><img src='skins/". $row['id'] .".png'></td><td><a href='view.php?id=". $row['id'] ."'>". $row['title'] ."</a></td><td>". $row['username'] ."</td><td>". $row['date'] ."</td><td>". $row['downloads'] ."</td><td>". $row['views'] ."</td></tr>"; } Yet, the user's name doesn't change. :/ Link to comment https://forums.phpfreaks.com/topic/232591-joined-queries/#findComment-1196358 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.