Zahra Naeem a écrit :
Hi all,
I tried to make a column in the table 'student_course' foreign key using the query
"ALTER TABLE student_course ADD FOREIGN KEY (Course_Id) REFERENCES course(Id)";
I also got the success message that the query has been executed successfully.
But when I tried the query "SHOW TABLE STATUS FROM db_name LIKE 'student_course' ;" to get foreign key information from the comments, the comments were empty.
I also used the function in libraries/relation.lib.php PMA_getForeigners() but the result is empty.
I think the foreign key is not being created properly so tell me the correct syntax for creating the foreign key.
I need help ASAP.
Regard, Zahra.
Your syntax to create the FK is correct. To see if your foreign key was created, you can use phpMyAdmin's export feature to see the structure export.
By the way, in libraries/export/sql.php in the PMA_getTableDef() function you'll see that SHOW CREATE TABLE is used to get what you need.