Mysql-PHP three-level navigation menu

Source: Internet
Author: User
I really don't know how to do it. I don't know which master is busy. I am so worried! Effect: -- table structure: arctypeCREATETABLEarctype (idsmallint (5) blocks, paridsmallint (5) unsignedNOTNULLdefault & #039; 0 & #039 ;...

I really don't know how to do it. I don't know which master is busy. I am so worried!
Effect:

-- Table structure arctype

CREATE TABLEarctype(
idSmallint (5) unsigned not null auto_increment,
paridSmallint (5) unsigned not null default '0 ',
typerankSmallint (5) unsigned not null default '0 ',
typenameChar (15) not null,
typedirChar (15) default NULL,
typetitleVarchar (80) not null,
typekeywordVarchar (120) not null,
typedescriptionVarchar (150) not null,
Primary key (id)
ENGINE = MyISAM default charset = utf8 AUTO_INCREMENT = 176;

INSERTarctypeVALUES (145, 0, 1, 'syntacay', 'yufa ', 'Online learning of German grammar', 'German grammar learning, online learning of German grammar, German grammar exercises, german syntax audio, German syntax video ',' we offer online learning of German syntax, the best website for learning German syntax ');
INSERTarctypeVALUES (164,145, 0, 'Usage of lattice ', 'ge', 'Usage of German lattice, online learning of usage of German lattice, getting started with usage of German lattice, usage video of German lattice, usage audio of German lattice, usage of German lattice, online learning of usage of German lattice, Introduction to usage of German lattice, usage video of German lattice, the usage audios for German cells, 'the online learning for usage of German cells, the best learning website for usage of German cells ');
INSERTarctypeVALUES (165,164, 0, 'yige', 'yige', 'Usage of German Lattice-one online learn', one German grid, one German grid, and one German Grid, video with one grid in German and audio with one grid in German. 'The online learning with one grid in German and the best learning website with one grid in German ');
INSERTarctypeVALUES (166,164, 0, '2', 'erge', 'Usage of German Lattice-L2 online learn', 'German L2, and German L2 online learnings, getting started with a German two-cell, German two-cell video, German two-cell audios, 'the online learning of German two-cell syntax, the best learning website for German two-cell syntax ');
INSERTarctypeVALUES, german three-cell video, German three-cell audio, 'the online learning of German three-cell syntax is available, and the best website for learning German three-cell syntax ');
INSERTarctypeVALUES (168,164, 0, '4ge', 'sige', 'Usage of German Lattice-four online learn', 'German 4ge', German 4ge', and getting started, video of German four cells, audio of German four cells, 'the online learning of German four-cell syntax is available, and the best website for learning German four-cell syntax ');

Please do not simply write JavaScript code and use ajax or js to loop. I also know that I am not very familiar with ajax and js! So please help me write it down. Thank you again!

Reply content:

I really don't know how to do it. I don't know which master is busy. I am so worried!
Effect:

-- Table structure arctype

CREATE TABLEarctype(
idSmallint (5) unsigned not null auto_increment,
paridSmallint (5) unsigned not null default '0 ',
typerankSmallint (5) unsigned not null default '0 ',
typenameChar (15) not null,
typedirChar (15) default NULL,
typetitleVarchar (80) not null,
typekeywordVarchar (120) not null,
typedescriptionVarchar (150) not null,
Primary key (id)
ENGINE = MyISAM default charset = utf8 AUTO_INCREMENT = 176;

INSERTarctypeVALUES (145, 0, 1, 'syntacay', 'yufa ', 'Online learning of German grammar', 'German grammar learning, online learning of German grammar, German grammar exercises, german syntax audio, German syntax video ',' we offer online learning of German syntax, the best website for learning German syntax ');
INSERTarctypeVALUES (164,145, 0, 'Usage of lattice ', 'ge', 'Usage of German lattice, online learning of usage of German lattice, getting started with usage of German lattice, usage video of German lattice, usage audio of German lattice, usage of German lattice, online learning of usage of German lattice, Introduction to usage of German lattice, usage video of German lattice, the usage audios for German cells, 'the online learning for usage of German cells, the best learning website for usage of German cells ');
INSERTarctypeVALUES (165,164, 0, 'yige', 'yige', 'Usage of German Lattice-one online learn', one German grid, one German grid, and one German Grid, video with one grid in German and audio with one grid in German. 'The online learning with one grid in German and the best learning website with one grid in German ');
INSERTarctypeVALUES (166,164, 0, '2', 'erge', 'Usage of German Lattice-L2 online learn', 'German L2, and German L2 online learnings, getting started with a German two-cell, German two-cell video, German two-cell audios, 'the online learning of German two-cell syntax, the best learning website for German two-cell syntax ');
INSERTarctypeVALUES, german three-cell video, German three-cell audio, 'the online learning of German three-cell syntax is available, and the best website for learning German three-cell syntax ');
INSERTarctypeVALUES (168,164, 0, '4ge', 'sige', 'Usage of German Lattice-four online learn', 'German 4ge', German 4ge', and getting started, video of German four cells, audio of German four cells, 'the online learning of German four-cell syntax is available, and the best website for learning German four-cell syntax ');

Please do not simply write JavaScript code and use ajax or js to loop. I also know that I am not very familiar with ajax and js! So please help me write it down. Thank you again!

Do unlimited classification directly. What is Level 3 navigation.
Unlimited classification is currently implemented in many ways.
I generally create an unlimited category directly. All the SQL statements are displayed. What you want.
Sorry. Didn't look at your code at first. Not that difficult.
Read your database table. Basically, an ID field is designed very old. Then there is a PID field. Then, set the value based on the same PID! This is the idea, right.
There are many practices. If you cannot query the database cyclically, submit the table. Join itself multiple times to produce results.
If you are in trouble. Multiple queries. Check all the children each time. Then query it cyclically! Ajax is basically the same idea. However, I do not like this database design method very much.
We recommend that you search for the adjacent list model.
And nested set model. About 10 years ago! These problems are no longer a problem. The first adjacency list you use is the simplest method. The advantage is insertion. Update. Easy to delete. Confirm the query. Of course. If you are interested, you can search for the martieral path. And more complex matrix encoding. These models are very mature in the implementation of unlimited classification. Let's look back at the author's questions. Maybe. You will. Wow. It turns out to be so simple.

For more information, see the code ~

PHP simple implementation of infinitus Classification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.