The following steps are required for you to be able to add foreign keys using phpadmin (in xampp).
- Select any table and go to operations tab, if InnoDB is listed under storage engine drop down menu then jump to step 5.
- So InnoDB is disabled in mysql engine, edit the \xampp\mysql\bi\my.cnf file and remove the hashes that are required to enable InnoDB (its self explanatory).
- Add a line in the above file, default_storage_engine=InnoDB (This makes InnoDB the default storage engine).
- Restart mysql from the xampp control panel or from MS services.
- Make sure, both PARENT and CHILD tables are of storage type InnoDB.
- REFERENCED key (in parent) should be primary and REFERENCING key (in child) should be index.
- In the CHILD table’s structure view, click on the link ‘relations view’ (it lies above ‘add fields’).
- In the row corresponding to the REFERENCING key, select the REFERENCED key from the second column drop box.
- Click go .. you’ll see that the required query is executed.
For storage type information go here.