I have created two table by generating via forms. My question is although second table's foreign key appears on phpmyadmin it doesnt have that same value with the first table's primary key.
currently foreign key has all zero values in all of the rows.
Table codes:
$sql2='CREATE TABLE IF NOT EXISTS CourseList(
Course_id int NOT NULL auto_increment,
CourseCode varchar(10) NULL,
CourseName varchar(40) NULL,
Instructor varchar(40) NULL,
PRIMARY KEY(Course_id)
)';
$sql3='CREATE TABLE IF NOT EXISTS StudentAccess(
StudentNumber varchar(12) NOT NULL,
StudentFirstName varchar(15) NOT NULL,
Course_id int NOT NULL,
FOREIGN KEY (Course_id) REFERENCES CourseList(Course_id) ON DELETE CASCADE
)';
how should i write foreign key code to link "StudentAccess's Course_id" to "CourseList's Course_id"??