$query = "SELECT myvalue FROM mytable WHERE some_condition";
$result = mysql_query($query) or die("Error: ".mysql_error());
$srch = "";
while( list($myvalue) = mysql_fetch_array($result)
{
        $srch .= "$myvalue, ";
}
$srch = substr($srch, 0, -2);
$query = "SELECT * FROM other_table WHERE this_val IN($srch)";
$result = mysql_query($query) or die("Error: ".mysql_error());

-----Original Message-----
From: Morten Nielsen [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 2:28 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Multiple SELECT querys


Hi,

I make a SELECT in a mySQL database. It returns a variable, which contains
10 values. I then need to make another SELECT in a new database where I have
to use the previous 10 values in the WHERE sentence. How can I do this?

Regards,
Morten



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to