I need to separate multiple field values with commas but I can't seem to get it to work, I've been trying to use .split(',') but maybe I can't do it this way.

Here's the part of the script I think this should go in:
Code:
    // Do the actual search
    function run_search(query) { 
        var cached_results = cache.get(query);
        if(cached_results) {
            populate_dropdown(query, cached_results);
        } else {
      var queryStringDelimiter = settings.url.indexOf("?") < 0 ? "?" : "&";
      var callback = function(results) {
        if($.isFunction(settings.onResult)) {
            results = settings.onResult.call(this, results);
        }
              cache.add(query, settings.jsonContainer ? results[settings.jsonContainer] : results);
              populate_dropdown(query, settings.jsonContainer ? results[settings.jsonContainer] : results);
            };

            if(settings.method == "POST") {
          $.post(settings.url, settings.queryParam + "=" + query, callback, settings.contentType);
        } else {
            $.get(settings.url + queryStringDelimiter + settings.queryParam + "=" + query, {}, callback, settings.contentType);
        }
        }
    }
};

// Really basic cache for the results
$.TokenList.Cache = function (options) {
    var settings = $.extend({
        max_size: 50
    }, options);

    var data = {};
    var size = 0;

    var flush = function () {
        data = {};
        size = 0;
    };

    this.add = function (query, results) {
        if(size > settings.max_size) {
            flush();
        }

        if(!data[query]) {
            size++;
        }

        data[query] = results;
    };

    this.get = function (query) {
        return data[query];
    };
};
The full script is at http://www.erecoverydev.com/autocomp....tokeninput.js

My php code is:
Code:
<?
mysql_pconnect("localhost", "myuser", "mypass") or die("Could not connect");
mysql_select_db("mydb") or die("Could not select database");
$param = mysql_real_escape_string ($_GET["q"]);

$query = sprintf("SELECT DISTINCT cb_activities FROM jos_comprofiler WHERE cb_activities REGEXP '^$param'");
$arr = array();
$rs = mysql_query($query);

while($obj = mysql_fetch_object($rs))
{
    $arr[] = $obj;
}

echo json_encode($arr);
?>