Jump to content

Double Query help?


whiteboikyle

Recommended Posts

Okay well here is my long php query..

 

select username, image, ranks.rName, members.ID, timestamp, aim, categories.ID, categories.name
				from members, ranks, ranklookup, categories
				where members.rank = ranks.id
				and ranks.id = ranklookup.rid
				and categories.id = ranklookup.cid
				and categories.id = ' . $cid . '
				and disabled = 0
				ORDER BY ranks.ID desc;

 

now there is 2 ID's that come up in this situation..

 

1 ID is for the ranks.. and the other ID is the members.. So would i echo either 1 using $row = mysql_fetch_array($result);

if i put $row['ID'] it could get confused?

Link to comment
Share on other sites

It'd spit out it's dummy and say that it can't tell which you want;

 

Try using:

 

select username, image, ranks.rName, members.ID as memID, timestamp, aim, categories.ID as catID, categories.name
				from members, ranks, ranklookup, categories
				where members.rank = ranks.id
				and ranks.id = ranklookup.rid
				and categories.id = ranklookup.cid
				and categories.id = ' . $cid . '
				and disabled = 0
				ORDER BY ranks.ID desc;

 

then use $row['catID'] and $row['memID'] as required :)

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.