Hi dmitri,
Thanks for the response. I just need to return simple data type (strings) in this case, so I am not sure if I still need to register complex types. What I was trying to do is return multiple records, but instead I am only getting a single record in return. I think (thou, I could be wrong), it’s the SQL statement in the soap server that is causing the problem. However, I can’t figure out where the problem is because when I use the SQL statement by itself in a php file (not with nuSoap), I get multiple records returned.
To give an example, my database table is:
Id Stock
1 IBM
1 MSFT
1 ORCL
2 IBM
2 CSCO
|
So, if in the client I enter id = 1, I should get the results as follows:
However, what I am getting back is:
That is, only the first record in the database, instead of all the records for that id.
Hope my explanation is a bit clear. Based on this should I still register complex types? Or would the way I have setup the soap server is fine? (sorry, I am all very new to this).
In the soap server, my SQL query is as follows:
function getStockQuote($id) {
mysql_connect('host','username','password');
mysql_select_db('db');
$query = "SELECT * FROM table "
. "WHERE id = '$id' ";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)){
return $row['address'];
}
}
|
Shouldn’t the while loop return all the records for the given ID? It does so, when I use the above SQL in a PHP file (without soap), but with soap, its only returns the first record.
Any ideas?
Thanks for your help.
Ray