Thanks :)

I've altered my controller to use set in my index() function:

<?php
class DataPointsController extends AppController
{
  var $name = 'DataPoints';
  var $helpers = array('form');

  function index()
  {
    $this->set('datapoints', $this->DataPoint->findAll());
    $sql = 'SELECT name FROM SOLDB.com_projects';
   $this->set('user', $this->DataPoint->query($sql));
  }

So I think my index.thtml file is getting the array but I'm getting a
new problem related to my select.

Fatal error: Call to undefined method FormHelper::select() in /Library/
WebServer/Documents/cake/app/views/data_points/index.thtml on line 3

Heres my index.thtml code

<h1>Data Points</h1>
<?php $form->select('users', $user, null, $user, 'User. . .'); ?>

I guess I'm setting the attributes wrong, could someone explain them
to me, the api confussed me.  Thank you

On Jun 4, 1:52 pm, Joshua Benner <[EMAIL PROTECTED]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to