here am trying to take the set of database values as comma separated and store it in a javascript variable. I tried doing it. but i couldnt make them comma separated as the output comes all together. Please correct me where am doing mistake.
Notes : If the value of assignedto is empty. the staff names with flag 1 will get fetched from database. but in the script below it comes all together where i require them to be comma separated.
if(assignedto == "")
{
'<?php
$val = mysql_query("select * from staff where flag='1'");
$arr='';
while ($row = mysql_fetch_array($val))
{
$arr = array($row['name']);
$assign .= implode(',',$arr);
?>'
assignedto = '<?php echo $assign; }?>';
}