Hi,
I have this simple php script that calls a function in
a database class, 
the function fetches rows of results from a databse
table. 

Now, the problem I am having is that it works but only
 *one* row is displayed (the first one)
My question is : how could one get the script to read
all the rows (pls see method 2 below that works but I
would like to do it using method 1). I have simplified
the script for brevity:


- Method 1 - displays only the first row

/*****  script file ******************/

// snip

$row=$datbs->show();
                ECHO  $row['id'];
                ECHO $row['Date'];
                ECHO $row['Name'];
                ECHO " <br>";


/***** class "datbs" ******************/

function show()
{
// snip

while ($this->row = mysql_fetch_array($this->result))
        {
                return ($this->row);
        }

// snip
}
/***********************/




- Method 2 -  this works and displays all the rows


/*****  script file ******************/

// snip

$row=$datbs->show();


/***** class "datbs" ******************/

function show()
{
// snip

while ($this->row = mysql_fetch_array($this->result))
        {
                ECHO  $this->row['id'];
                ECHO $this->row['Date'];
                ECHO $this->row['Name'];
                ECHO " <br>";
        }

// snip
}
/***** ******************/

Regards,
David


        
        
                
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com


------------------------ 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