Hi Jon! If you wanna do that, use pass by reference operator "&" in front of your method/function, the method should be like this:
class someClass { function &fetchArray() { // do something } } Good luck, Firman ----- Original Message ----- From: "Jonathan Villa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 10, 2004 10:27 PM Subject: [PHP] Passing array from class to class produces more than one result... > I'm writing a DBI class with the following function > > function Select($sql) > { > $this->setResultID(@mysql_query($sql,$this->getDBConn())); > if ($this->getResultID() == false) > Error::fatalError(__FILE__.' ('.__LINE__.') : Unable to run query : > '.mysql_error().'('.mysql_errno().')'); > > $this->setNumRows(@mysql_num_rows($this->getResultID())); > $this->setArray(@mysql_fetch_array($this->getResultID())); > } > > > When I call this, I want to be able to run > > while($data = $objDBI->FetchArray) > { > echo $data['username']; > } > > but the results I get are > > jvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvillajvilla.... etc.... > > my $sql query is simple > > SELECT username FROM staff; > > and there are four rows in the db... > > > For some reason, I can't pass the value of mysql_fetch_array out of the > Select function. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php