1000) { $limit = 1000; } $query = (isset($VARS["q"]) ? strtolower($VARS["q"]) : ""); $results = $database->select( "ballotitems", [ "[>]ballotitemtypes" => ["itemtype" => "type"] ], [ "itemid (id)", "label", "description", "ballotitemtypes.text (type)" ], [ "OR" => [ "label[~]" => $query, "description[~]" => $query ], "LIMIT" => $limit ] ); for ($i = 0; $i < count($results); $i++) { $results[$i]["label"] = ucwords($results[$i]["label"]); } header("Content-Type: application/json"); sendJsonResp(null, "OK", ["count" => count($results), "results" => $results]);