Hi -

There are a couple problems here:
1.) Return exits and returns the value immediately, so you're never 
going to get to the 2nd row.
2.) You can only pass one thing back from the function, so you probably 
want to assemble an array of values.

>/***** class "datbs" ******************/
>
>function show()
>{
>// snip
>while ($this->row = mysql_fetch_array($this->result))
>       {
>               return ($this->row);
>       }
>
>// snip
>}
>
Try this:
function show()
{

    // $this-> is for accessing/placing a variable in the class scope.
    // You probably don't need to place $row in the class scope for the 
purposes of assembling a result set to pass back.
    while ($row = mysql_fetch_array($this->result))
    {
       $result[] = $row; // this creates an ordered array, appending 
each new value to the end of the array.
    }

    return $row; // Pass the array you've assembled back
}

On another note, the PEAR DB class is a really nice database abtraction 
class. 
If you're looking for a nice OO way to interact with the database, 
they've done a good job with it.

http://pear.php.net/manual/en/







------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/CefplB/TM
--------------------------------------------------------------------~-> 

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to