[Phpwm] nuSoap question

Simon Ferre simon at needanother.co.uk
Thu Oct 5 10:48:47 BST 2006


On Thursday 05 October 2006 10:18, Ray Masa wrote:
> >>Code:
> >>
> >><?php
> >>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['stock'];
> >>     }
> >>}
> >>
> >>Code:
> >>
> >>    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)){
> >>     echo $row['stock'];
> >>     }
> >>
Having seen the code above, it would appear that the problem lies in using the 
code within a function.  You are trying to return the rows one at a time 
(within the while construct) but the first return encountered ends the 
function.  You would have to return an array of values instead.

Hope that helps.

Simon Ferre

P.S. Anyone know how to enter an accented e from the keyboard under linux?  In 
windows, it's <Alt Gr>+e but that doesn't work under linux. My surname 
doesn't look so good without it.



More information about the Phpwm mailing list