here is another version
<?php
$result2 = mysql_query ("SELECT * FROM news_area_data WHERE news_id = $SID");
$nastring = ''; // we start with empty $nastring
while ($row2 = mysql_fetch_array($result2)) {
$value = $row2['news_area_id'];
// Add to the $nastring, we append using: .=
$nastring .= $value . '/';
//Same as
// $nastring = $nastring . $value . '/'; or
// $nastring = $nastring . "$value/"; or
// $nastring .= "$value/";
}
// remove '/' from last
$nastring = rtrim( $nastring, '/' );
if( empty($nastring) ){
echo 'no results';
}
else{
echo $nastring;
// this could have been done from the beginning, in result loop
// but if needed later
// store result $nastring in an array $news_ids()
$news_ids = explode( '/', $nastring );
}