php while
$query="SELECT products_id
FROM products
WHERE products_imgaes =146.jpg";
while($row=mysql_fetch_array($rs)){
$all_array = $row['products_id'];
echo 'one=' .$all_array."
";
}
echo 'two=' .$all_array."
";
?>
假如one= 输出的结果是123,23,4545,465465,856.
可是two= 输出的结果却是856.我想要的结果是123,23,4545,465465,856.怎么办呢,帮帮忙,谢谢了。
------解决方案--------------------
把echo 'two=' .$all_array."
";写到while循环里面去。
------解决方案--------------------
可以定義個變量撒。。
<?php $rs="SELECT products_id FROM productsWHERE products_imgaes =146.jpg";$two = '';while($row=mysql_fetch_array($rs)){$all_array = $row['products_id'];echo 'one=' .$all_array."<br>";$two .= $all_array."<br>";} echo 'two=' .$two;<div class="clear"> </div>