Function to obtain subclass_id collection_PHP tutorial

WBOY
Release: 2016-07-13 10:30:48
Original
862 people have browsed it

function get_bottom_class_id($class_id){
	if(!isset($class_id) || !is_numeric($class_id)){
		return false;
	}
	global $db;
	static $class_id_array=array();
	$sql="select `class_id` from `".TB_PREFIX."web_class` where `class_parent_id`='".$class_id."'";
	$rows=$db->getRowsArray($sql,MYSQL_NUM);
	if(!empty($rows) && is_array($rows)){
		foreach($rows as $row){
			get_bottom_class_id($row[0]);
		}
	}else{
		$class_id_array[]=$class_id;
	}
	if(is_array($class_id_array)){
		$class_id=implode(',',$class_id_array);
	}else{
		$class_id=$class_id_array;
	}
	return $class_id;
}
Copy after login

Articles you may be interested in

  • php function to extract the birthday date from the ID number and verify whether it is a minor
  • XDebug The progress bar stops at 57%, prompting the solution to the waiting for XDebug session error
  • Introduction to the union, intersection and difference functions of arrays in php
  • The most accurate string length interception function in php
  • Fatal error Class 'SoapClient' not found in ... Error handling method
  • Fatal error Class 'ZipArchive' not found ... Solution
  • PHP number judgment function
  • How to set default parameter values ​​for functions in Javascript

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764198.htmlTechArticlefunction get_bottom_class_id($class_id){if(!isset($class_id) || !is_numeric($class_id)) {return false;}global $db;static $class_id_array=array();$sql="select `class_id` from `".TB_P...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template