You are here: Re: Objects or not ? « PHP Programming Language « IT news, forums, messages
Re: Objects or not ?

Posted by floortje4 on 11/13/07 14:05

On 13 nov, 14:40, Jerry Stuckle <jstuck...@attglobal.net> wrote:

Hi Jerry,

> First of all, don't do the select in your code. Let your objects do it.

Yup just trying to make the point without producing tons of code :-)

> In this case, create a userlist class and let it perform the select
> statement, building a new userobject for each row.

Maybe I dont understand you but is what im trying to avoid. Lets say
$aData contains 1000 rows with unique UserId's. Then this code would
produce 1001 select queries.

function CreateUserObj()
{
$aData=$db::select('SELECT UserId FROM forum');

foreach ($aData as $val)
{
// executes a new select statement
$aUserObj[$val['UserId']]=new User($val['UserId']);
}

return $aUserObj;
}

 

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

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