First, I would recommend using the CakePHP Manua (
http://manual.cakephp.org ).
Passing data to a view is accomplished in the controller via:
$this->set('varName', $value);
A variable with the name specified in the first argument is then
available in the view.
[EMAIL PROTECTED] wrote:
> Hey
>
> I'm new to cakePHP and I'm going round in circles trying to create a
> multi select box in my view.
>
> I have a controller with a function users(). The function will return
> the SQL query result that I want to populate my select box.
>
> <?php
> class DataPointsController extends AppController
> {
> var $name = 'DataPoints';
>
> function index()
> {
> $this->set('datapoints', $this->DataPoint->findAll());
> }
>
> function view($id = null)
> {
> $this->DataPoint->id = $id;
> $this->set('datapoints', $this->DataPoint->read());
> }
>
> function users()
> {
> $sql = 'SELECT name FROM SOLDB.com_projects';
> $result = $this->DataPoint->query($sql);
> return $result;
> }
> }
> ?>
>
> How do I use this function in my view file, index.thtml?
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---