Jump to content

Array Help


moneygrinch

Recommended Posts

Ok so I take a value and search my database.  I then count how many rows are returned.

 

What I want to do is take those returned values and run them against the database to find new values.

 

Example

Value A = Value x =  Value B

                            Value C

                            Value G

              Value y=  Value M

                            Value P

              Value Z = Value O

So how would I check for 3 values at once? 

$level_2 = @mysql_query("SELECT member_id FROM center WHERE upline_id=[i]my 3 values[/i]);}

 

NOTE: The values may be any amount, not just 3.. They may be 1, 10, 100, etc.

 

HELP!

 

Link to comment
https://forums.phpfreaks.com/topic/43209-array-help/
Share on other sites

Is this right?

You select records from table xyz where valueA = something.

You then want member_id values from center where their upline_id matches the values returned in valueX from the first query

[pre]

center              xyz

---------            ----------------

member_id            valueA

upline_id <--------- valueX

[/pre]

 

SELECT DISTINCT c.member_id

FROM center c INNER JOIN xyz x ON c.upline_id = x.valueX

WHERE x.valueA = 'someting'

Link to comment
https://forums.phpfreaks.com/topic/43209-array-help/#findComment-209841
Share on other sites

Ok I start out with one value.

 

Value 1

 

And I use this value to search the database.  It returns any number of results.

 

Value A, Value B, Value C, Value D, etc.

 

I want to know how to take these newly aquired values and search the same database for new values.

 

I was trying to use the Select value in PHP.

 

while($level_1a = mysql_fetch_array($level_1, MYSQL_ASSOC)){$level_2 = @mysql_query("SELECT member_id FROM call_center WHERE upline_id=$level_1a[member_id]");}

 

But how do you run an array in a query?

 

Is it possible?

Link to comment
https://forums.phpfreaks.com/topic/43209-array-help/#findComment-209909
Share on other sites

The method I gave you should do it without the intermediate array and need for a second query.

But if you insist,

 

<?php
$array = array('Value A', 'Value B', 'Value C', 'Value D');

$valueList = join ("','", $array);

$sql = "SELECT member_id FROM call_center WHERE upline_id IN ('$valueList') ";
?>

Link to comment
https://forums.phpfreaks.com/topic/43209-array-help/#findComment-209914
Share on other sites

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.