J. Doe
J. Doe

Reputation: 73

Getting mysql result into a jquery array

I am trying to get this array as a result of mysql result.

var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
    ];

Is it as simple as:

var availableTags [] = <php echo $result['availabletags']; ?> ;

Or should I do something else?

Upvotes: 0

Views: 88

Answers (1)

Prabhu Nandan Kumar
Prabhu Nandan Kumar

Reputation: 1255

You can get your result by run of following query :

while( $row = mysql_fetch_assoc( $result)){
    $new_array[] = $row; // Inside while loop
}

Let me know if you face any issue.

Upvotes: 1

Related Questions