I don't know where the error is returned in lines 7 or 8. & lt ;? Include (& quot; includesconfig. php & quot;); error lei (0); $ ii0; functionlei ($ belongs_id) {$ sqlmysql_query (& quot; select * frompro_typewherebelongs_id & q. I don't know where the error is. rows 7 and 8 report an error.
Include ("des/config. php ");
// Line 7 and 8 report an error
Lei (0 );
$ Ii = 0;
Function lei ($ belongs_id ){
$ SQL = mysql_query ("select * from pro_type where belongs_id = '". $ belongs_id. "'", $ conn );
While ($ rs_info = mysql_fetch_array ($ SQL )){
// Category
If ($ belongs_id = 0 ){
Echo "category ";
} Else {
Echo "small class ";
}
$ Ii = $ ii + 1;
Lei ($ rs_info ["id"]);
$ Ii = $ II-1;
}
}
?>
------ Solution --------------------
It is found that it is a problem of variable scope. The variable in the function is a local variable. $ conn must be declared as global if you want to use a global variable.
------ Solution --------------------
PHP code
------ Solution --------------------
Do you want
Global $ conn;
$ SQL = mysql_query ("select * from pro_type where belongs_id = '". $ belongs_id. "'", $ conn );