So here is the case . I have baked the cake php application normally . The site runs fine on a local server . But when migrated to bluehost server it starts having issues in hasmany and belongs to associations . The issue i found was basically in the array containing the data. E.g $comments usually has the data
Array ( [Comment] => Array ( [id] => 46 [name] => asddasd [email] => sdaa [website] => asdasd [commentdata] => asdasd [postdate] => 2012-04-27 08:20:00 [post_id] => 2 ) [Post] => Array ( [id] => 2 [title] => Fighter Aircraft [category] => Military [description] => asddasdasdasdasdasd [body] => Hello this is second [created] => 2012-04-10 18:41:43 [modified] => 2012-04-27 13:25:33 [user_id] => 0 ) )
but on the webserver it looks like
Array ( [Comment] => Array ( [id] => 8 [name] => ddasdasdsdasd [email] => asdasd [website] => asdasd [commentdata] => adasdasdasdad [postdate] => 2012-04-23 23:15:00 [post_id] => 8 ) )
Thus ending up showing following error
Undefined index: Post [APP/View/Comments/index.ctp, line 24] The line 24 is
<?php echo $this->Html->link($comment['Post']['title'], array('controller' => 'posts', 'action' => 'view', $comment['Post']['id']));
Please tell a fix for this ?