No, you are not misunderstanding the problem, and thankyou for your
response!
$this->set('conds',$this->Diagnosis->Condition->generateList(null,
null, '{n}.Condition.id','{n}.Condition.condition'));
entering that in my controller results in a sql syntax error
Query: SELECT `Condition`.`id`, `Condition`.`condition`,
`Condition`.`created_on`, `Condition`.`updated_on` FROM `conditions`
AS `Condition` WHERE 1 = 1 LIMIT {n}.Condition.id
Warning: SQL Error: 1064: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near '{n}.Condition.id' at line 1
I am guessing that the '{n}.Condition.id' is causing the problem and
have tried editing that out. I still get no more that the list of id's
in the select list in the view however
On 31 May, 14:31, francky06l <[EMAIL PROTECTED]> wrote:
> You explanation is not so clear, but I think you mean that the
> generateList returns only the id and not the 'Condition' field ? If
> so, generateList is by default making the array of the fields named
> 'id' and 'name'.
> As you might not have a 'name' field, you can set it into the model or
> pass parameters to the generaList method such as :
>
> generateList(null, null, '{n}.Condition.id',
> '{n}.Condition.condition');
>
> Hope this help and I am not misunderstanding the problem
>
> On May 31, 12:10 pm, g5Maniac <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > I am tyring to generate a select list in an edit view - all very basic
> > stuff. I am however getting the wierdes result to my query.
>
> > diagnosis_controller
> > (edit)
> > $this->Diagnosis->id = $id;
> > $this->data = $this->Diagnosis->read();
> > $this->set('conds',$this->Diagnosis->Condition->generateList());
>
> > edit view
> > <p><select>
> > <?php foreach($conds as $cond): ?>
> > <option value="<?php echo $cond['id'] ?>"><?php echo
> > $cond['Condition'] ?></option>
> > <?php endforeach; ?>
> > </select></p>
>
> > This returns the id for each condition, but only 1 character of it!. I
> > turned debug on and in the SQL I can see
> > SELECT 'Condition'.'id' FROM 'conditions' as 'Condition' WHERE 1=1
>
> > Now thats some bizzare SQL!
>
> > Any Ideas?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---