Help with array in class needed
| From: | Alexander Czernay | Date: | Sun, 11 Nov 2001 03:12:56 +0000 |
| Subject: | Help with array in class needed | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-74148@lists.php.net to get a copy of this message | ||
I've written a class that reads a database into an array. This works fine,
but when I try to copy the array outside the class using a function that
only does a return $this->$data, I only get one sub-array of the whole one.
Any ideas?
Thanks
Alexander
Code:
class Adressen {
var $connect; // database-handle
var $daten = array(); // array for data
// Constructor
function Adressen($datenbank) {
$this->$connect = $datenbank->getConnect();
}
// read data from database
function readData() {
$this->$daten = array();
$result = mysql_query("select * from adressen");
while($data = mysql_fetch_array($result)) {
extract($data);
$this->$daten[$AdressenID] = array("strasse" => $Strasse, "plz" =>
$PLZ,
"ort" => $Ort, "land" => $Land, "telefon" => $Telefon,
"telefax" =>
$Telefax, "email" => $Email);
}
}
function getData() {
return $this->$daten;
}
}