Jump to content

a "WHERE" problem that I simply don't know how to do


xwishmasterx

Recommended Posts

I am trying to do a query for members in my database but I need to go through different tables to get those members I want. Let me try too describe:

 

I want the members who has same team_id as current member (from same table)

I want only the members who are online (from another table where time stamps are, which has members id, but not team id)

 

I simply cannot figure out how to only get members with same team id as the current member, from the table with time stamps.

 

Anyone can point me in the right direction, or is the above just not making sense at all?

 

 

I think I found a way to add the team_id to the tracking table, but cannot seem to get it just right. Found this piece of code:

 

 //Add to Tracking
	      $remote_ip = $_SERVER[REMOTE_ADDR];
	      $UPD_SQL = "INSERT INTO vtp_tracking(credit_members_id,debit_members_id,url_id,action_date,remote_ip,teamid)
	        VALUES('$members_id','$url_members_id','$url_id', NOW() , '$remote_ip' );";

 

So I added a column in above table named teamid (added this to above code also).

 

how can I add the result of this query to the above code VALUES?:

 

$sql= "SELECT team_id FROM vtp_members WHERE id=$members_id";
  $result = mysql_fetch_array( $sql );

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.