I have an error "SQL Error in model Stage: 1052: Column 'entreprise_id'
in where clause is ambiguous"

I have a stage model

<?php

class Stage extends AppModel
{
    var $name = 'Stage';

    var $belongsTo = array('Entreprise' =>
                            array('className' => 'Entreprise'),
                                  //'foreignKey' => 'entreprise_id'),

                           'Contact' =>
                            array('className' => 'Contact'));



    var $hasAndBelongsToMany = array('Etudiant' =>
                                     array('className' => 'Etudiant' ,

                                           'joinTable' =>
'etudiantstages',
                                           'foreignKey' => 'stage_id',
                                           'associationForeignKey' =>
'etudiant_id',
                                           'uniq' => true));







    var $displayField = "intitule";

    var $validate = array(
        'intitule'=>VALID_NOT_EMPTY,
        'description'=>VALID_NOT_EMPTY,
        'responsable'=>VALID_NOT_EMPTY,
        'departement'=>VALID_NOT_EMPTY,
        'datedebut'=>VALID_NOT_EMPTY);

}

?>


and i hava also a warning "Warning: Invalid argument supplied for
foreach() in C:\wamp\www\gestionstage\app\views\stages\present.thtml on
line 5
"


ma function present is

function present($id)
    {
        $this->set('data',$this->Stage->findAll("entreprise_id =
$id","id,intitule,description"));
    }


I don't understand why this error because i hava the same thing for
another table and it functions perfectly

Need your help


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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