Page 1 of 1
Users management panel
Posted: Mon Feb 07, 2011 4:53 am
by jankidudel
Hi,
I was thinking about in what style It will be better to develop this module: " admin see all users, can add, edit , remove..." There is only list of all the users(with all of the info), then admin can click on the edit image and edit him.
To store info about the user for the editing purpose I was thinking about 2 possible ways to do that, but which is better, which is the professional way, maybe any?
1. add to the link , userid=$userid, and then query mysql for the userid info.
2. store all users on this page info into $_SESSION, and we don't need to use mysql...
What do you think ?
I'm not talking about technical implementation, I'm talking about the design principles.
Re: Users management panel
Posted: Mon Feb 07, 2011 8:21 am
by Darhazer
1 - pass the id in the link
Some reasons:
1. If you store info in the session, what will happen if another administrator or the user himself edit the user profile after the data was loaded in the session and before you click the edit? You will see the old info
2. If you store data in the session, unless you don't use some advanced session handler, the whole data will be loaded in the memory on every page request, even when you are not in the users section at all.
3. As you are asking about design decision, actually the code should not know if the data is in the session or in the database - it's should be hidden by the User Model.
Re: Users management panel
Posted: Mon Feb 07, 2011 8:38 am
by jankidudel
Thanks for the reply.
Note about your 2nd observation:
"who prohibits me to unset session ? "
Re: Users management panel
Posted: Mon Feb 07, 2011 9:43 am
by Darhazer
jankidudel wrote:Thanks for the reply.
Note about your 2nd observation:
"who prohibits me to unset session ? "
Nobody, it's up to you. But if you set 10 users in the session just to have data about one of the users, you will load in the memory 9 users that you'll just unset. Well, there can be much more arguments against using session in this case, the question is if there is a single argument for using it (hitting MySQL won't be the case, as this will be extremely fast primary key lookup and you can add caching (memcache) at the DB layer anyway)
Re: Users management panel
Posted: Mon Feb 07, 2011 10:17 am
by jankidudel
Now, maybe some off-topic question.

, you are zend programmer, say I'm thinking to learn 2 new frameworks , 1 small to medium projects(codeigniter), and 1 for bigger(future projects), thinking about what to use for the bigger ...
1. Symfony ? ( "People in forums are saying that it's hard to learn)
2. Zend ? ( I've read about it that it is just a bunch of modules, not the real framework)
Can you write couple sentences about that ? Can I be sure that once learned Zend I could be doing all i want ?
Re: Users management panel
Posted: Tue Feb 08, 2011 2:33 am
by Darhazer
Actually I'm not a zend programmer (there is a separate certification for zend framework) but there are few in the forum.
Learning 2 different frameworks is a good idea and I've always recommended to learn one small framework (codeigniter/kohana/cake php) and one big (symphony/zend)
Can I be sure that once learned Zend I could be doing all i want ?
No. You have to learn to program. Language and framework are tools, learning to use the tools does not ensure that you can build a house
