Jump to content

Finding multiple values in Where Command PHP, MYSQL


moneygrinch

Recommended Posts

Ok, so I am trying to do a complex code.  The code begins by retrieving the values relevent to 1 other value.

$level_1 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id={$_SESSION['member_id']}");
//$upca = mysql_fetch_array($upcalc, MYSQL_ASSOC);
$upc = mysql_num_rows($level_1);
$level_1a=array($upc);
if($upc > 0){
$upc = $upc;

}else{
$upc ="None";
}

As you can see it finds all files relevant to 1 value.  And then counts all the values and reports the total.

 

Now what I need to do from here is take these NEW values and check for all of them in a new search.  So I am thinking that I need an array() with all the new values to cross check in the new query.  I came up with this.

 

$level_2 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id=$level_1a");
$upc_2 = mysql_num_rows($level_2);
if($upc_2 > 0){
$upc_2 = $upc_2;
}else{
$upc_2 ="None";
}

 

It is not right, and I am not sure if I can even do it this way.

 

The logic is that if the initial values returns 3 values say: 1, 2, 3

that the new code will compare the table for those values and then return the listings with those values.

 

Any ideas? 

Ok, so I am 1 step closer.  This how ever only compares to 1 value, while ignoring the others.

<?
// upline figuration
//Level 1
$level_1 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id={$_SESSION['member_id']}");
$level_1a = mysql_fetch_array($level_1);
$upc = mysql_num_rows($level_1);

if($upc > 0){
$upc = $upc;

}else{
$upc ="None";
}
//Level 2
$level_2 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id=$level_1a[member_id]");
$upc_2 = mysql_num_rows($level_2);
if($upc_2 > 0){
$upc_2 = $upc_2;
}else{
$upc_2 ="None";
}
?>

 

How do I get it to also compare to the other values?

 

I am thinking this is my problem upline_id=$level_1a[member_id]

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.