Problem With Related Tables

Hello! I hope you could help me.

I got a problem when copying some files from my localhost server to a online server.

I got two tables, Alumno and Proyecto

In my localhost server I can do this:


but in the online server this gets an error.

I don’t know the reason of this, and I need this reference to work properly, I use it very often in my code.

Is there a problem for this reference in some versions of php, apache or mysql?

Please help me

Hello Phyxius,

First of all, please check that you are NOT using MyISAM in your production server.

Then, check that all the foreign keys are correctly created.

And finally, check that the minimum records in the "master tables" have been inserted.

Best regards.

Thanks for your response.

I’m working with InnoDB for my tables, and all foreing keys are correct.

Actually I exported my localhost db and imported to my production server so that should not be a problem.

I can reach the related tables by using find() and the id but I can’t reach them using the access $table1->table2_id provided by yii.


I find a solution! In my Cgridview I get the model by pk.

'value' => 'Cosa::Model()->FindByPk($data->cosa_id)->cosa_name'

Thanks for the help.