-
Try it this way, create table types (
type_id` int(11) not null auto_increment,type_name` varchar(20) not null,type_p_id` varchar(64) not null default '-',primary key (`type_id`),key `type_name` (type_name`),key `tname` (type_name`)
engine=myisam auto_increment=14 default charset=utf8
Note: There is no valid validation of the field here;
The type id indicates that the primary key is self-incrementing.
Type Name indicates the name of the category.
The type p id represents the classification path, where the classification path is the classification path of the parent class of the upper level, plus the primary key id of this class, separated by a comma.
error_reporting(7);
header("content:text/html;charset=utf-8");
Let's start with the judgment of the operation.
arr = array('list','add','del','edit','addok','edit_ok');
act= in_array($_get['ac'],$arr)?$get['ac']:$arr[0];
Connect to the database.
conn = mysql_connect("localhost","root","root")or die('The database connection failed');
mysql_select_db("study",$conn);
mysql_query("set names utf8");
Sort according to the classification layer.
sql = "select * from types order by type_p_id";
sql1 = mysql_query($sql);
Add a taxonomy. if($act == "addok"){
type_id = $_post['type_id'];
type_name = $_post['type_name'];
If it is equal to 0 table. If you still don't understand, you can look at the backing person ** to find the answer, you have time to look at it for a long time, and slowly understand, I hope it can help you, thank you.
-
This doesn't count as php knowledge, right?,Ask the front-end.。
-
Set a variable to store the url, and then use include or require to include the recent one, and I don't know if it's the effect you want.
url = 'Web page address';
include_once($url);
-
1。Use an HTML iframe
When you click on the link, target="mainshow"The page will be displayed in an iframe.
-
1. Frame import, iframe
2. AJAX dynamic request.
3. Use the functions file get contents and file put contents
-
Data can now be called via ajax.
-
1 Yes.
2 thinkphp Infinitus Categories can be displayed in pagination.
-
The method of optimization should be thought of when designing the taxonomy, and recursive database search is the lowest practice. The classification table should have a childs field, which stores all the sub-categories of the current classification, including level 2, level 3, level 4, and so on. When you click on the category search, you can directly enter the product list in (childs field).
Another way to do this is to save all the categories as an array in a PHP file, regardless of hierarchy. You recursion this array of PHP files later in the recursion to classify. The end result is actually the childs field of method 1.
I don't know how you do that, but obviously the joint check classification table and the commodity table can't do this kind of function, unless performance issues are not considered.
You say that you can only display products in the 2nd level category is definitely not recursive, or maybe you only have one layer of recursion.
-
Recursively implements Infinity classification.
param $array categorical data.
param $pid parent ID
param $level classification level.
return $list can be used to traverse the indentation directly, $level can be used to traverse the indentation.
function gettree($array, $pid =0, $level = 0)
return $list;}/*
Obtain the recursive data and traverse to generate a classification.
$array = gettree($array);
foreach($array) as $value
-
The principle is that where there is a son, there must be a father, just like a family tree.
-
Look at the method written inside, It's based on the table, the field, check it out, and then keep going down to check it level by level, It's best to take out the ** and take a look...
-
In the case of a database, the field has one more parent ID
Infinite Classification returns multidimensional arrays.
protected function cat_tree($list,$parent_id=0)
return $temp;}/*
Infinite Classification returns a two-dimensional array.
function cat_arr($list,$parent_id,$level)
return $temp;}
-
Recursive infinite sub-column queries are just like city data tables.
-
To give you a function, calling get category() is an array of results: function get category($parent id=0).
return $arr;}
-
You're right about the design. Just recursion.
-
Unlimited Classification 2 Lines ** Done.
function gentree5($items)
To join Infinitus, you need someone to introduce you, see if there is anyone around you who is Infinitus, and if so, ask him to take you in. >>>More
Founded in 1992 by Li Huisen, Infinitus is a modern large-scale enterprise engaged in the research and development, production, sales and service of Chinese herbal health products.
99% of people who say infinitely good are not experts. Ordinary people are the most. Very few people who work at Infinitus are medical-related. >>>More
If you buy a product of 498 yuan or more at the retail price, submit a copy of your ID card. Provide the addresses of Bank of China, ICBC, Agricultural Bank of China and CCB, and the store will give you a membership card, you are a member of the Infinitus family, and you can operate the four categories of Infinitus products.
Ningbo people said"Auntie"What is the meaning?