sunnyk Posted February 8, 2007 Share Posted February 8, 2007 Hi, I'm trying to build a soap/php distributed system as an assignment. Making good progress but I'm stuck on passing a query result to another page. Here is the code of the page that gets the result from the db. <?php function getFlightDetails($depart,$arrive,$day,$month,$year){ mysql_connect('localhost','','') or die("Unable to connect to MySQL"); mysql_select_db('ds'); $query = "SELECT * FROM flights WHERE (departure = '$depart' AND destination = '$arrive' AND dep_day = $day AND dep_month = $month AND dep_year = $year)"; $result = mysql_query($query); return $result; } require('nusoap\lib\nusoap.php'); $server = new soap_server(); $server->configureWSDL('flightserver','urn:flightresult'); $server->register("getFlightDetails", array('depart' => 'xsd:string','arrive' => 'xsd:string','day' => 'xsd:integer','month' => 'xsd:integer','year' => 'xsd:integer'), array('return' => 'xsd:rowset'), 'urn:flightresult', 'urn:flightresult#getFlightDetails'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> And here is the page that trys to get the results and display them <?php require_once('nusoap\lib\nusoap.php'); $c = new soapclient('http://localhost/ds.php'); $available_flights = $c->call('getFlightDetails', array('depart' => 'Dublin','arrive' => 'Cork','day' => '01','month' => '01','year' => '2007')); $num=mysql_numrows($available_flights); $i=0; while ($i < $num) { echo mysql_result($available_flights,$i,"airline"); echo mysql_result($available_flights,$i,"departure"); echo mysql_result($available_flights,$i,"destination"); echo mysql_result($available_flights,$i,"dep_hour"); echo mysql_result($available_flights,$i,"dep_min"); $i++; } ?> Does anyone know how I do this? The error I'm getting is: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\flights_client.php on line 9 Quote Link to comment Share on other sites More sharing options...
only one Posted February 8, 2007 Share Posted February 8, 2007 um thats the wrong function $num=mysql_num_rows($available_flights); try that Quote Link to comment Share on other sites More sharing options...
sunnyk Posted February 8, 2007 Author Share Posted February 8, 2007 um thats the wrong function $num=mysql_num_rows($available_flights); try that Still the same error message as before Quote Link to comment Share on other sites More sharing options...
only one Posted February 8, 2007 Share Posted February 8, 2007 im gettin the exact same error on my site Quote Link to comment Share on other sites More sharing options...
sunnyk Posted February 8, 2007 Author Share Posted February 8, 2007 Anybody got any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.