Array Into New Query

Advertisement

In $array the relevant ids (userid) are stored successfully. now i try to use the values from $array in a new query (in another db):

foreach ($array as $value) {
$query="SELECT * FROM table WHERE subject=". $value['userid']";
$result=mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
echo $row; }
}

with the above code i get the following error message: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource.