NuSOAP & returning Arrays...
| From: | Jeremy Thibeaux | Date: | Thu, 03 Jul 2003 18:39:25 +0000 |
| Subject: | NuSOAP & returning Arrays... | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-751@lists.php.net to get a copy of this message | ||
Right now I am dealing with some strange behavior when returning arrays.
I have a function registered with a NuSOAP server that essentially creates an array as follows based
on results of a MySQL DB query:
function buildresultstable($res){
if ($res == null) return null;
$num_rows = mysql_num_rows($res);
$table = array();
for ($i = 0; $i < $num_rows; $i++){
$table[$i] = mysql_fetch_assoc($res);
}
return $table;
}
However, when I receive this array on the other side, NuSOAP appears to have added an outer array
containing only the above table, meaning I have to remember to use
$res[0][rownum]["fieldname"] to access the data. Is there a reason for this, and is there
a way to prevent this extra outer array from being created -- requiring the extra "[0]"
kinda irritating?
This does not, incidentally, occur when I am returning a one dimensional associative array, but I
imagine that may be because it doesn't appear to treat them as arrays when generating the SOAP
message.
Jeremy