$sql = "select photopath from infochild where parentid=$id";
$res = mysql_query($sql);
$filenum = mysql_num_rows($res);
$img = array();
$j=0;
while ($myrow=mysql_fetch_array($res)){
$photopath=$myrow["photopath"];//图片路径
for ($i=0;$i<$filenum;$i++){
if (file_exists($photopath)){
//if pic exists then give img array value
$img[$j] = $photopath ;
$j++;
//at same time give hidden str value.
$imgstr = "<img src=".$img[$j]."><br><input type='hidden' value='".$img[$j]."' name=".$img[$j].">";
}
}
} reset($img);
while(list($key,$val)=each($img))//可以遍历数组
{
echo "[".$key."]->".$val."<br/>";
}你看看有没有启发,你也可以用print_r($img);检查一下,看看吧,不明白的地方请跟贴!^_^
$res = mysql_query($sql);
$filenum = mysql_num_rows($res);
$img = array();
$j=0;
while ($myrow=mysql_fetch_array($res)){
$photopath=$myrow["photopath"];//图片路径
for ($i=0;$i<$filenum;$i++){
if (file_exists($photopath)){
//if pic exists then give img array value
$img[$j] = $photopath ;
$j++;
//at same time give hidden str value.
$imgstr = "<img src=".$img[$j]."><br><input type='hidden' value='".$img[$j]."' name=".$img[$j].">";
}
}
} reset($img);
while(list($key,$val)=each($img))//可以遍历数组
{
echo "[".$key."]->".$val."<br/>";
}你看看有没有启发,你也可以用print_r($img);检查一下,看看吧,不明白的地方请跟贴!^_^
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货