Home > Backend Development > PHP Tutorial > PHP recursively implements a function to generate drop-down lists by infinite categories_PHP Tutorial

PHP recursively implements a function to generate drop-down lists by infinite categories_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:35:07
Original
839 people have browsed it

Copy code The code is as follows:

/*—————————————————— * /
//– Recursive implementation of infinite classification generation drop-down list function
//– $tpl->assign('sort_list',createSortOptions ());
//– $tpl->assign( 'sort_list',createSortOptions ($sort_id));
/*—————————————————————— */
function createSortOptions ($selected=0,$parent_id= 0,$n=-1)
{
global $db;
$sql = "SELECT * FROM `@__article_sort` WHERE `parent_id` = '{$parent_id}'";
$ options = ";
static $i = 0;
if ($i == 0)
{
$options .= 'n";
$options .=createSortOptions ($selected,$row['sort_id'],$n);
}
}
return $options;
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322308.htmlTechArticleCopy the code as follows: /*—————————————————— — */ //– Recursive implementation of unlimited classification to generate drop-down list function //– $tpl-assign('sort_list',createSo...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template