You are here: Adding a custom object to an array « PHP Programming Language « IT news, forums, messages
Adding a custom object to an array

Posted by Areric on 05/07/06 23:46

Hey all,

Anyone have any idea what im doing wrong here:

$image = new Image();
$image->SetImageContent($imageRow['imageContent']);
$image->SetFileSize($imageRow['fileSize']);
$image->SetFileName($imageRow['fileName']);
$image->SetImageId($imageRow['imageId']);
$image->SetParentImageId($imageRow['parentId']);
$image->SetFileType($imageRow['fileType']);
$image->SetImageHeight($imageRow['height']);
$image->SetImageWidth($imageRow['width']);
$image->SetIsThumbnail($imageRow['isThumb']);
$this->mImages[$this->mImageCount] = $image;

where Image is a custom class and mImages is an array declared as
follows:
$this->mImages = array();

Whats happening is im executing this function
function GetImage($imageIndex)
{
return $this->mImages[$imageIndex];

}

and then trying to call a member function on the returned value
i.e.
$image = $album->GetImage(1);
$imageId = $image->GetImageId();

and im getting this error" Fatal error: Call to a member function on a
non-object in
/home/flyerweb/public_html/ImageManipulator/POCPages/DisplayAllImagesInAlbum.php
on line 30"

Any idea why i cant add a custom object to an array then pull it back
out and call a method?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация