You do this:
echo "['$user_name','$user_id'],";
... meaning that it will generate this:
[ ['a','b'], ['a','b'], ['a','b'], ['a','b'], ]
Notice that it will always end with a "," and this is an incorrect syntax.
Correct syntax is :
[ ['a','b'], ['a','b'], ['a','b'], ['a','b'] ]
I'm not a PHP guy, but I'd say something like this would fix it :
var tokens = [<? $result = mysql_query("SELECT * FROM accounts ORDER BY id DESC") or die (mysql_error()); $i = 0; while ($row = mysql_fetch_array($result)) { $i++; $user_name = $row['user']; $user_id = $row['id']; echo "['$user_name','$user_id']"; if($i < sizeof($result)-1 ) // incorrect syntax, but you get the point echo "," } ?>]