[phpxmlrpc] DB result and array
TeddyZ
teddyalf at quipo.it
Mon Jul 21 23:27:22 BST 2003
Hi, sorry for my english..i'm going to expose you what's my problem.
I have client and server . the client call a method . this method retrieve
values from a mysql db but i can't see these values. i'm very newbie :|
here is my code, i thing i'm in error with the array of my method...can you
help me please?
sorry for the stupid question (i think..uhm..i'm sure)
bye!
client.php
include("xmlrpc.inc");
$message=new xmlrpcmsg('examples.conn');
$client=new xmlrpc_client("/test/server.php", "xmlrpc.datto.lan", 80);
$response=$client->send($message);
$value=$response->value();
if (!$response->faultCode()) {
print "Queste sono le sezioni trovate".
$value->scalarval() . "<BR>";
print "<HR>vedi:<BR><PRE>" .
htmlentities($response->serialize()). "</PRE><HR>\n";
} else {
print "Fault: ";
print "Code: " . $response->faultCode() .
" Reason '" .$response->faultString()."'<BR>";
}
server.php
include("xmlrpc.inc");
include("xmlrpcs.inc");
function conn() {
mysql_connect('localhost','root');
mysql_select_db('publish');
$sql="select * from sezioni";
$res=mysql_query($sql);
$count=mysql_num_rows($res);
for ($i=0;$i<$count;$i++){
$row=mysql_fetch_array($res);
$sezioni[]=new xmlrpcval($row['nome_sezione'],"array");
}
return new xmlrpcresp(new xmlrpcval("$row[nome_sezione]", "array"));
}
$server=new xmlrpc_server( array("examples.conn" =>
array("function" => "conn")));
More information about the phpxmlrpc
mailing list