[Phpwm] nuSoap question
Ray Masa
raymasa at hotmail.com
Tue Oct 10 08:55:48 BST 2006
Thanks Simon. Phil Beynon suggested a similar solution. I will work on
that and see if can get it to work.
Ray
>
>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
>
More information about the Phpwm
mailing list