PHPÎÞÏÞ·ÖÀàµÄÀý×Ó£¨°üÀ¨Êý¾Ý¿â£©×ª
ÆäËû³£¼ûµÄÎÞÏÞ·ÖÀà·½·¨£º
1£¬¼òµ¥µÄͨ¹ýµÝ¹é²éѯ¼ÓĿ¼path×ֶεÄÎÞÏÞ·ÖÀà
ȱµã£º²éѯÊý¾Ý¿â´ÎÊýÌ«¶à£¬²»·½±ãÆäËû²Ù×÷£¬±ÈÈçɾ³ý½Úµã¡£Ìí¼Ó½Úµã£¬Òƶ¯½Úµã
2£¬×óÓÒÖµÎÞÏÞ·ÖÀ࣬ԤÅÅÐò¶þ²æÊ÷
ȱµã£º²Ù×÷·±Ëö£¬Êý¾Ý¿âÈßÓ࣬ÇÒÌí¼Óɾ³ýÐ޸Ķ¼Òª½øÐÐ×óÓÒÖµ¸üÐÂ
±¾·ÖÀà·½·¨µÄÓÅÊÆ£º
1£¬Êý¾Ý¿â½á¹¹¼òµ¥£¬Ö»ÓÐ cid parentid name Èý¸ö×ֶΣ¬ÎÞÈκÎÈßÓà×Ö¶Î
2£¬²»Ê¹Óõݹé²éѯ£¬ËùÓвÙ×÷Ö»ÐèÒ»ÌõsqlÓï¾ä
3£¬ËùÓÐÊý¾ÝÔÚ¶ÁÈ¡Ò»´ÎÊý¾Ý¿âºó£¬ÔÚÊý×éÄÚ½øÐзÖÎö´¦Àí£¬½ÚÊ¡Êý¾Ý¿â·þÎñÆ÷×ÊÔ´
´´½¨Êý¾Ý¿âÒÔ¼°±í£º
CREATE DATABASE `sortclass`DEFAULT CHARSET utf8;
CREATE TABLE IF NOT EXISTS `class` (
`cid` mediumint(8) unsigned NOT NULL auto_increment,
`pid` mediumint(8) unsigned NOT NULL,
`cname` varchar(50) NOT NULL,
PRIMARY KEY (`cid`),
KEY `pid` (`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
´¦ÀíÎļþʾÀý£º
<?php
header("Content-type: text/html; charset=utf-8");
//Á¬½ÓÊý¾Ý¿â
$link = mysql_connect('localhost','root','eric') or die(mysql_error());
mysql_select_db('sortclass',$link);
//ÎÞÏÞ·ÖÀàÀà¿â
class SortClass{
var $data = array();
var $child = array(-1=>array());
var $layer = array(-1=>-1);
var $parent = array();
var $link;
var $table;
function SortClass($link, $table){
$this->setNode(0, -1, '¶¥¼«½Úµã');
$this->link = $link;
$this->table = $table;
$node = array();
$results = mysql_query('select * from '.$this->table.'',$this->link);
while($node = mysql_fetch_assoc($results)){
$this->setNode($node['cid'],$node['pid'],$node['cname']);
}
}
function setNode ($id, $parent, $value){
$parent = $parent?$parent:0;
$this->data[$id] = $value;
$this->child[$id] = array();
$this->child[$parent][] = $id;
$this->parent[$id] = $parent;
$this->layer[$id] = !isset($this->layer[$parent])? 0 : $this->layer[$parent] + 1;
}
function getList (&$tree, $root= 0){
foreach ($this->child[$root] as $key=>$id){
$tree[] = $id;
if ($this->child[$id]) $this->getList($tree, $id);
}
}
function getValue ($id){return $this->d
Ïà¹ØÎĵµ£º
<?php
/*
* Ãû³Æ : MySQLÊý¾Ý¿â»ù±¾²Ù×÷
* ×÷Õß : pjx
* °æ±¾ : v 2010/02/25 v 1.0
* ˵Ã÷ : ¸ÃÀàÓÃÓÚ¶ÔMySQL×öһЩ¼òµ¥µÄ²Ù×÷
* ʾÀý £º
* ʵÀý => $db = new DB_MYSQL($database),´ò¸ö$databaseÊý¾Ý¿â
* ²éѯÊý¾Ý¿â => $db->query($sql_str),²éѯ$sql_st ......
¡¾×ª×Ô¡¿£ºhttp://blog.miaoheguang.tk/archives/11
±»PHPµÄinclude·¾¶ÅªÔÎÁË¡£×Ô¼ºÊÔÑéһͨ£¬×ܽáÈçÏ¡£
¶¨ÒåA=°üº¬Îļþ B=±»A°üº¬µÄÎļþ C=±»B°üº¬µÄÎļþ
Ò²¾ÍÊÇ˵ A °üº¬ B£¬ B°üº¬C
AÖÐÓÐ
Php ´úÂë
require ‘[B·¾¶]‘ //(ÕâÀï µÄrequire¿ÉÒÔ»»³Érequire_once include)
require ‘[B·¾¶]&l ......
Ê×ÏÈÒªÁ˽âsqlÓï¾ä
$SQL="delete from `PHP100` where id in (1,2,4)";
±íµ¥´ó¸ÅÊÇ£º
<form action="" method="post">
<input name="ID_Dele[]" type="checkbox" id="ID_Dele[]" value="1"/>
<i ......
×î½üÕâ¶Îʱ¼äûÓÐÔõôÈÏÕæȥѧϰһÑù¶«Î÷£¬·´¶øÊÇÕâÑùѧһµãÄÇÑùѧһµãµÄ£¬´º½Ú¸Õ¹ý¿´ÁËÒ»ÏÂASP£¬ÒòΪÀÏʦÕÒÎÒ°ïæŪһÏÂÍøÕ¾£¬µ±Ê±¾õµÃASP»á£¬ËùÒÔ¾ÍÏÈÒÔASPÀ´Á˽âÕâÒ»ÃÅ£¬Ïà¶ÔÆäËûµÄJSP£¬phpÀ´Ëµ£¬ASP»¹ÒªÊìϤһЩ£¬ËùÒÔµ±Ê±¾Í¿´ÁËÒ»ÌìASP£¬¿ÉÒÔ˵ÊÇÎÂÏ°°É¡£
Ò ......
½ñÌì2010-02-26£¬¿ªÊ¼ÎÒµÄphpѧϰ֮·£¬
¼Æ»®ÔÚδÀ´µÄÒ»¶Îʱ¼äÄÚ£¬ÓÃ×ã¹»¶àµÄʱ¼äºÍ¾«Á¦À´Ñ§Ï°Á˽âphp¡£
×öµ½¾«Í¨Àí½â»¹ÓоÍÊÇ×Ô¼º¶ÀÁ¢µÄ¿ª·¢³öһϵÁеÄÍøÕ¾£¬×÷Ϊ¶Ô×Ô¼ºÑ§Ï°µÄ¼ìÑé¡£
×öºÃ¼¼Êõ×ܽáºÍ¼¼ÊõÄÚºËÀí½â ......