This article describes the two-level linkage menu effect implemented by Php+mysql. Share to everyone for your reference, specific as follows:
<!--Php+mysql Two-level linkage-->
SQL statement:
Structure of the----table ' colleges '--CREATE table IF not EXISTS ' colleges ' (' college_id ' int (8) not NULL auto_increment COMMENT ' College The number automatically increases ', ' name ' varchar () not NULL COMMENT ' College name ', PRIMARY key (' college_id '), UNIQUE key ' name ' (' name ') engine=in
Nodb DEFAULT charset=gb2312 auto_increment=7; ----Export the data in the table ' colleges '--INSERT into ' colleges ' (' college_id ', ' name ') VALUES (4, ' Chemistry and Chemical College '), (1, ' College of Computer and Information Science '), (6, ' Beauty
College of Surgery '), (2, ' Faculty of Arts '), (5, ' Conservatory of Music '), (3, ' School of Political and Public administration '); ----table's structure ' majors '--CREATE table IF not EXISTS ' majors ' (' major_id ' int (8) Not NULL auto_increment ' professional number, automatically increased ' , ' name ' varchar NOT NULL COMMENT ' professional name ', ' college_id ' int (8) Default NULL COMMENT ' Institute ', ' counsellor_id ' int (d) Efault NULL COMMENT ' counselor ', PRIMARY key (' major_id '), UNIQUE key ' college_id ' (' college_id ', ' counsellor_id ') Engine=inn
ODB DEFAULT charset=gb2312 auto_increment=8; ----Export the data in the table ' majors '--INSERT into ' majors ' (' major_id ', ' name ', ' college_id ', ' counsellor_id ') VALUES (1, ' e-commerce ', 1, 1
),(2, ' musical Solfeggio ', 5, 1), (3, ' classical literature ', 2, 1), (4, ' Computer Science ', 1, NULL), (5, ' Automation ', 1, NULL), (6, ' modern literature ', 2, NULL), (7, ' News Writing ', 2, NUL
L);
More about PHP Interested readers can view the site topics: "PHP based on PDO Operation Database Skills Summary", "PHP+MONGODB Database Operation Skills Encyclopedia", "PHP object-oriented Programming Program Introduction", "PHP string (String) Usage Summary", " Introduction to PHP+MYSQL Database operations and a summary of PHP common database operations Tips
I hope this article will help you with the PHP program design.