开发者

Passing multiple variables to server with PHP and SOAP?

开发者 https://www.devze.com 2023-01-29 17:22 出处:网络
I wonder if it\'s possible to send multiple variables at once to the server? For example: $client->AddTheseValues($a, $b, $c);

I wonder if it's possible to send multiple variables at once to the server? For example:

$client->AddTheseValues($a, $b, $c);

The server/MySQL would then add th开发者_StackOverflowose values into the database:

public function AddTheseValues($a, $b, $c) {

$this->sql = "INSERT INTO `records` (`a`,`b`,`c`) VALUES
     ('{$a}','{$b}','{$c}');";

$result = mysql_query($this->sql);

}

The above procedure doesn't seem to work with me; I'm only able to send ONE variable at time. When I send more than one, the database won't get updated and weirdly I get no error messages.


You can pass an array.

$responses = array();
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);

$response = array("Response" => $responses);

$soapData = array("Responses" => $response);

Source of the code above Passing a PHP array in a SOAP call

I hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消