" . 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 Name, unitCount from $table where Name LIKE '$pat%' LIMIT ".$max_rows; // mysql_connect('130.133.70.51', 'webuser' , ''); // mysql_select_db('syn_europe'); mysql_connect('130.133.70.51', 'WebUser' , ''); mysql_select_db('caucasus'); $result = mysql_query($sql); $s = ""; $i = 0; while ( ($row = mysql_fetch_array($result))) { $s .= "
" . highlight($row['Name'],$pat) . " (" . number_format($row['unitCount'],0 , ',', '.') . ")
"; } if (mysql_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 ))); ?>