HI, I'm trying to dynamically retrieve data from database and stuff all these data into an empty select list thru javascript. But I can't get it to work

PHP Code:
while( $row mysql_fetch_array$sql ) )
{
       
$getChildren .= 'var newCElem = document.createElement("OPTION");';
       
$getChildren .= 'newCElem.value = "' $row['id'] . '";';
       
$getChildren .= 'newCElem.text  = "' $row['label'] . '";';
       
$getChildren .= 'allPaths.add(newCElem);';

$getChildren will be spit out to my javascript code part where I've place <%getChildren%>. When I try to manually type in the output into the javascript code, it works but not when dynamically.

anyone?