Converts classified data into readable XML files to call a PHP code that dynamically converts classified data into XML files. The data structure (id, pid, rank, category ), where pid is the parent ID (the first level is 0), rank is the level (0 is the first level, level 1 is the second level, and so on), category is the category name, theoretically, it supports unlimited hierarchical conversion.
"); Include (" ../include/mysql. class. php "); $ id = (isset ($ _ GET [id])? $ _ GET [id]: 0; print ("
"); Show_item ('Table _ name', 0); // table_name is your classification table name print ("
"); Function show_item ($ database, $ pid) {$ db = new mysql (); $ query =" select * from $ database where parent = '$ pid '"; $ result = $ db-> query ($ query); while ($ r = $ db-> fetch_array ($ result) {print ("
". $ R [rank]."
". $ R [category]."
"); If ($ r [rank]! = '3') show_item ($ database, $ r [id]); // 0: Level 1, Level 3: Level 4, and so on ("
") ;}$ Db-> close () ;}?>