Model:
class Availability extends AppModel {
    var $name = 'Availability';
    var $useTable = 'bform';

    function something() {
        return $this->find('list', array ('fields' => array ('row1',
'row2_E')));
    }
}

In controller:
function index() {
    $this->set('bform', $this->Availability->something());
}

In view:
echo $this->Form->input('Availability.somename', array ('type' =>
'select', 'options' => $bform));

On 14 июн, 17:26, heohni <[email protected]> wrote:
> Hi,
>
> I have to use for a project a database which is a copy of a MS Access
> database and I can't influence the name convention or its structure.
>
> This way I can't work like usually with Cake Models.
>
> I used
> class Availability extends AppModel {
>     var $name = 'Availability';
>     var $useTable = false;
>
> }
>
> And in my controller I do 'static' sql statements like
> function index() {
>     $bform = $this->Availability->query("SELECT row1, row2_E FROM
> bform");
>     $this->set(compact('bform'));
>
> }
>
> debug($bform);
> returns something like:
>
> Array
> (
>     [0] => Array
>         (
>             [bform] => Array
>                 (
>                     [row1] => 10
>                     [row2_E] => Torispherical Heads to DIN 28011
>                 )
>
>         ) etc...
>
> How can I create now a form input (<select...>) with row1 as key and
> row2_E as value?
> I tried $this->set(compact('bform'));
> But this returns me just a text field.
>
> I also have to say that row1 is defined as varchar field.
> And I am not able to change that... I have to work with this crap.
>
> In the case that CAKE isn't able to help me, how can I create a input
> select myself?
> Any ideas?
>
> Thanks!!!

-- 
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