how can I give foreign key relation?
In PHP? Or do you mean MySQL?
In PHP code is there any possibility that we can do that
Do what? You’re going to have to elaborate…
Things like Zend Framework can simulate Foreign Key relations, but this is best done in your database config. If you’re using MySQL, you’ll need to set your tables to use InnoDB - the default will probably be MyISAM.
The first answer here will help you setup the keys in PHPMyAdmin.