CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 20999 OCIStmtExecute: ORA-20999: TAPI-1005:Violata chiave esterna STUDENTE_DOCENTE_FK della tabella STUDENTE
HOW CAN I SET FOREIGN KEY?
I have tried
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'docente'=>array(self::HAS_MANY, 'studente', 'DOCENTE_MATRICOLA')
);
}
This is in the model studente
Page 1 of 1
FOREIGN KEY
#2
Posted 28 April 2010 - 04:13 AM
Why are you opening a new thread for the exact same error as in another thread of yours
http://www.yiiframew.../8924-error-db/
http://www.yiiframew.../8924-error-db/
Find more about me.... btw. Do you know your WAN IP?
#3
Posted 28 April 2010 - 04:19 AM
mdomba, on 28 April 2010 - 04:13 AM, said:
Why are you opening a new thread for the exact same error as in another thread of yours
http://www.yiiframew.../8924-error-db/
http://www.yiiframew.../8924-error-db/
Yes i do but now don't work!!!I have always the same error..
The table have other foreign key...i don't understand if i set all keys not only one
#4
Posted 28 April 2010 - 04:22 AM
With public function relations()you set the relations, you don't set the key...
the error means that you are inserting a record for the table STUDENTE with a value for STUDENTE.DOCENTE_ID that does not exist in the table DOCENTE
the foreign key you have to set by means of user input or by adding in your code something like $model->docente_id = 3 (where 3 is ID of DOCENTE that DOES EXIST in the DOCENTE table)
hope you understand...
P.S. please don't open new threads for already discussed problems (comment on existing one) because this way we clobber the forum... and is more useful for later reading if one problem is discussed in one thread
the error means that you are inserting a record for the table STUDENTE with a value for STUDENTE.DOCENTE_ID that does not exist in the table DOCENTE
the foreign key you have to set by means of user input or by adding in your code something like $model->docente_id = 3 (where 3 is ID of DOCENTE that DOES EXIST in the DOCENTE table)
hope you understand...
P.S. please don't open new threads for already discussed problems (comment on existing one) because this way we clobber the forum... and is more useful for later reading if one problem is discussed in one thread
Find more about me.... btw. Do you know your WAN IP?
Share this topic:
Page 1 of 1

Help












