0){ while ($a = mysql_fetch_assoc($result)){ $pictures[] = $a; } } //print_r($pictures); $first = current($pictures); $js = "var titles = new Array(); "; while ($a = each($pictures)){ $js .= "titles['".$a[1]['sm_pic']."'] = '".$a[1]['name']."'; "; } reset($pictures); ?>