Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6747403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:26:17+00:00 2026-05-26T12:26:17+00:00

here am trying to take the set of database values as comma separated and

  • 0

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; }?>';
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:26:18+00:00Added an answer on May 26, 2026 at 12:26 pm

    I am not sure, but you code seems to be wrong, have you tried this?

    if(assignedto == ""){
       <?php
       $val = mysql_query("select * from staff where flag='1'");
       $arr=array();
       while ($row = mysql_fetch_array($val)){
           $arr[] = $row['name'];
       }
       $assign = implode(',',$arr);
       ?>
       assignedto = '<?php echo str_replace('\'','\\\'',$assign); ?>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Overlooking something basic here but I am trying to set a variable and have
Programming Student here...trying to work on a project but I'm stuck. The project is
I know of the ||= operator, but don't think it'll help me here...trying to
Noob dumb question, no doubt -- but here it is: Trying to tutorialize myself
I have a program that I am trying to take a set of numbers
I am trying to set up an SMS gateway on my computer here's some
I'm trying to set a gem repository on one of our local servers. Here
I'm sure there's a really easy way of doing this. I'm trying to take
I am trying to take a look into our database performance issues by making
I am trying to set up a tagging system, but i am having a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.