Arrays/OOP
| From: | Joshua E Minnie | Date: | Tue, 05 Mar 2002 18:51:53 +0000 |
| Subject: | Arrays/OOP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87312@lists.php.net to get a copy of this message | ||
I am relatively new to PHP but have had some background in OOP. I am having some trouble with a
method that for a certain class. The problem is that I can seem to read my objects from an array
that I am storing them to. I keep getting the error "Call to a member function on a
non-object". I have attached the code that contains the error, I would appreciate any help
that can be provided.
function getEvents($filename) {
//string $filename
$event_list = array();
$event_object = new event();
$i = 0;
@ $fp = fopen($filename, "r");
if(!$fp) {
echo "<p><strong>Cannot open ".$filename." for reading
mode...</strong></p>";
exit;
}
while(!feof($fp)) {
$temp = fgetcsv($fp, 1024, ":");
$event_list[$i] =
$event_object->init($temp[0],$temp[1],$temp[2],$temp[3],$temp[4],$temp[5],$temp[6],$temp[7],$temp[8]);
$i++;
}
fclose($fp);
return $event_list;
}
P.S. Please CC it directly to me, as I will receive the reply faster that way.
Joshua E Minnie
CIO
josh@acsurf.net
"Don't work for recognition, but always do work worthy of recognition."