我有将结果添加到变量中的 sql 语句但是当我将该变量($team)放在我的第二个 sql 语句中时它不起作用 WHERE id = '$team'。我该怎么办?
$query = mysql_query("SELECT team_name FROM team");
$team = array();
while($row = mysql_fetch_assoc($query)){
$team[] = $row;}
echo $arra[0];
$loop=count($team);
for($x=0;$x<$loop;$x++)
foreach($team[$x] as $child) {
$result = mysql_query("SELECT * FROM members
WHERE id = '$team'")
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
echo '<td>' . $row['first_name'] . '</td>';
}