php while
<?php
$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."<br>";
}
echo 'two=' .$all_array."<br>";
?>
假如one= 输出的结果是123,23,4545,465465,856.
可是two= 输出的结果却是856.我想要的结果是123,23,4545,465465,856.怎么办呢,帮帮忙,谢谢了。
[解决办法]
把echo 'two=' .$all_array."<br>";写到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;