Hi I have a function with two parameters. $vehicle and $name to know who to reply to and why type of vehicle to update. my service code is as follows
function bookVehicle($vehicle, $name){
$conn = mysql_connect('localhost', 'root') or die('Something wrong');
if(!$conn){
return "Couldn\'t connect to the db";
}
$dbname = 'tomsbikes';
mysql_select_db($dbname, $conn);
$update= 'UPDATE '.$vehicle.' SET amount = amount-1 WHERE amount != 0';
$result = mysql_query($update, $conn);
while($row = mysql_fetch_array($result)){
$value = $row['type'];
$cost = $row['price'];
mysql_close($conn);
return "Congratulations " .$name. " you have succesflully booked a ".$type." vehicle costing: ".$cost;
}
} |
I know I am not returning the results from the database properly, this is not a big issue for this project;
My client side code is:
$rentalName = $_REQUEST["rental"];
$name = $_REQUEST["firstname"];
$vehicle = $_REQUEST["vehicle"];
require_once('nusoap.php');
$s = new nusoap_client("http://localhost/DistSys/".$rentalName.".php?wsdl",true);
$proxy = $s->getProxy();
$result = $proxy->bookVehicle($vehicle, $name);
echo '<h1 class="color">'.$result.'</h1>';
|
The way i am registering the function is:
$s->register('bookVehicle',
array('vehicle' => 'xsd:string', 'name' => 'xsd:string'),
array('return' => 'xsd:String'),
$ns); |
The problem is that the mysql update query executes fine, but it does not return the string to echo. All other functions from this service work fine.
Can any one see what the problem would be.[/code]