Hi,
I am quite a newbie in PHP but am trying to do the following;
I have a mysql Db with schedule data such as show names, episodes, start and end times etc.
I have created a soap server service and client which work - code is below. Currently I am passing the item name and retrieving its info. Now I would like to be able to retrieve multiple rows of data and return these to the client. I would like to query something like this;
"SELECT item.name, episode.episodeID, slot.start, slot.end
FROM (episode
INNER JOIN item ON episode.itemID = item.itemID)
INNER JOIN slot ON episode.episodeID = slot.episodeID
ORDER BY slot.start ASC";
How can I do it? any ideas please? Thanks
<?php
//client
require_once('nusoap.php');
$c = new soapclient('http://localhost/nusoap/xmlservice.php');
$info = $c->call('getSchedule',
array('symbol' => 'Friends'));
echo "The info for 'Friends' is $info.";
?>
<?php
// server
function getSchedule($itemname) {
mysql_connect('localhost','user','pass');
mysql_select_db('tvdb');
$query = "SELECT item.info FROM item "
. "WHERE item.name = '$itemname'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
return $row['info'];
}
require('nusoap.php');
$server = new soap_server();
$server->configureWSDL('xmlservice', 'urn:schedule');
$server->register("getSchedule",
array('itemname' => 'xsd:string'),
array('return' => 'xsd:string'),
'urn:schedule',
'urn:schedule#getSchedule');
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)
? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>