RE: [PHP-DB] Multiple SELECT querys
| From: | Rick Emery | Date: | Fri, 22 Mar 2002 20:53:57 +0000 |
| Subject: | RE: [PHP-DB] Multiple SELECT querys | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-17847@lists.php.net to get a copy of this message | ||
$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:mosgaard2000@hotmail.com]
Sent: Friday, March 22, 2002 2:28 PM
To: php-db@lists.php.net
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