" . substr($x, 0, strlen($var)) . "" . substr($x, strlen($var), strlen($x) - strlen($var)); else return $x; } function getTaxonList($query) { $max_rows = 50; $p = $query->getParam(0); $pat = ucfirst($p->scalarval()); $p = $query->getParam(1); $table = str_replace('field_', 'suggest', $p->scalarval()); $sql = "select TOP ".$max_rows." Name, unitCount from $table where Name LIKE '$pat%' ORDER BY Name ASC "; // connect to ODBC data source $conn = odbc_connect('syn_botany', 'WebUser', 'WebUser2014'); if (!$conn) { exit("Connection Failed: " . odbc_errormsg($conn)); } // execute sql query $result = odbc_exec($conn, $sql); if (!$result) { exit("Error in SQL"); } $s = ""; $i = 0; while ( ($row = odbc_fetch_array($result))) { $s .= "
" . highlight($row['Name'],$pat) . " (" . number_format($row['unitCount'], 0, ',', '.') . ")
"; } if (odbc_num_rows($result) == $max_rows) { $s .= "
..."; } return new xmlrpcresp(new xmlrpcval($s, 'string')); } // Declare our signature and provide some documentation. $sig = array(array($xmlrpcString, $xmlrpcString, $xmlrpcString)); $doc = 'bla'; new xmlrpc_server(array( 'suggest.getTaxonList' => array( 'function' => 'getTaxonList', 'signature' => $sig, 'docstring' => $doc ))); ?>