我试图过滤一个表,以根据条件将值选择为某些行.第一个相当复杂的SELECT可以正常工作,为我提供一组id.但是我想在数组中使用此id组($art_id)作为第二个SELECT,以便更直接地获取行.希望有人哈建议.谢谢,艾伦.
这里不包括第一个SELECT -我通过print $art_id获取值; …但是只有最后一个值显示在我的图像列表SELECT中,因为我需要正确使用数组
$QUERY1="SELECT.....etc,..." ///this works fine
$res = MysqL_query($QUERY1);
$num = MysqL_num_rows($res);
if($num>0){
while($row = MysqL_fetch_array($res)){
$art_id = $row['art_id'];
print $art_id;
$a1 = array($art_id); ///this $a1 var didn't work in the SELECT below.
}
}
///here is where I need to have an array var instead of just $art_id
$QUERY2="SELECT * FROM artWork WHERE art_id = '$art_id'";
$res = MysqL_query($QUERY2);
$num = MysqL_num_rows($res);
if($num>0){
while($row = MysqL_fetch_array($res)){
$art_title = $row['art_title'];
$artist_name = $row['artist_name'];
$art_id = $row['art_id'];
$media = $row['media'];
echo.....etc,...../// only one image (the last,of course) shows up here
最佳答案