logo       

nusoap - Array - adding extra rows: msg#00091

php.nusoap.general

Subject: nusoap - Array - adding extra rows

Hi!

Well, my webservice is working and I'm very happy :-).

In one of my methods I retrieve information that is returned as a Array,
the data that is printed in my client (.NET) is ok, however I find that
allways the client prints an extra row, for example:

If I retrieve an array of two rows, there will be two rows, ok? 1 and 2.
But when I run it in my client:

$ mono cliente.exe
1
0
2
0

See?, why a '0'? Maybe it's my error in C#, the code:

foreach(Category cat in jaws_client.GetCategories("user","password")) {
Console.WriteLine(cat.cat_id);
}

Where Category:

public class Category {

/// <remarks/>
public int cat_id;

/// <remarks/>
public string cat_name;
}

Ahh, and the php GetCategories:

function GetCategories($user, $pass) {
if(Login($user, $pass) != 0) {
$sql = "select category.id, name, count(blog.id) as howmany
from category left join blog on
category.id = category_id
group by category.id, name order by name";

$rs = $GLOBALS["app"]->db->query($sql);
while ($r = $rs->next()) {
$cats[]["cat_id"] = $r["id"];
$cats[]["cat_name"] = $r["name"];
}

return $cats;


}
else {
return 0;
}
}


any ideas?.
Thanks!
--
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Fingerprint: 5973 0F10 543F 54AE 1E41 EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx
http://www.debianmexico.org



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise