Jump to content

Joined Queries?


3raser

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.