Ideally database access should be done in a model or maybe a
controller... never from a view. In this way you have separated all
your business control logic.
There should not really be a requirement to access the database
directly as that is the job that CakePHP was designed to do.

For what you have described it sounds like you can populate your
dropdown list through a find('list' ... ) call in the controller or
write a function to do it in the model and call that from the
controller. If you require the list to change in realtime within the
view, then Ajax may well be the best way to proceed.

Just my thoughts on it...


On Jan 20, 11:15 pm, opike <[email protected]> wrote:
> I want to custom populate some drop down boxes in an add view and I
> was wondering what is considered best practice. Can I just grab the
> database connection as indicated in this 
> thread:http://ask.cakephp.org/questions/view/how_can_i_access_the_mysql_data...
>
> and start issuing queries or is there some other way that I should
> work through the model?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to