mysql+php select ÏÂÀÁбíÊ÷µÄ¼òµ¥ÊµÏÖ
Êý¾Ý¿âÉè¼Æ£º
--
-- Êý¾Ý¿â: `test`
--
-- --------------------------------------------------------
--
-- ±íµÄ½á¹¹ `menu`
--
CREATE TABLE IF NOT EXISTS `menu` (
`ID` int(10) unsigned NOT NULL auto_increment,
`PID` int(11) NOT NULL,
`TITLE` varchar(200) NOT NULL,
`REMARK` varchar(200) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;
--
-- µ¼³ö±íÖеÄÊý¾Ý `menu`
--
INSERT INTO `menu` (`ID`, `PID`, `TITLE`, `REMARK`) VALUES
(1, 0, '¹«Ë¾', '¸ù'),
(2, 1, '²ÆÎñ²¿', '²¿ÃÅ'),
(3, 1, 'ÏúÊÛ²¿', '²¿ÃÅ'),
(4, 1, 'ÈËʲ¿', ''),
(5, 2, '»á¼Æ', ''),
(6, 3, 'ÒµÎñÔ±', ''),
(7, 4, 'ÈËÊÂ×ܹÜ', '');
--------------------------------------------------------
PHP´úÂ룺
--------------------------------------------------------
<?php
include "config.php";
include "mysql.php";
$db = new Mysql('test'); //¼¸¸ö¼òµ¥µÄÀ࣬²»ÓÃÁгöÀ´´ó¼ÒÒ²¿´µÃ¶®¡£¾ÍÊÇʵÀý»¯Ò»¸öÊý¾Ý¿âÁ¬½Ó¶øÒÑ¡£
function RootMenu ($PID,$n){
global $arr,$db;
$sql = "select * from menu where `PID` =$PID";
$result = $db->query($sql);
while ($i=$db->fetch_array($result)){
$i["TITLE"] =str_repeat('--',$n).$i["TITLE"];
$arr[] =$i;
RootMenu($i["ID"],($n+4));
}
return $arr;
}
$arr = RootMenu(0,0);
?>
<select id="">
<option value="0" selected="selected">ÇëÑ¡Ôñ²¿ÃÅ</option>
<?php
for ($i=0;$i<count($arr);$i++) {
?>
<option value="<?php echo $arr[$i]["ID"] ?>"><?php echo $arr[$i]["TITLE"] ?></option>
<?php }?>
</select>
--------------------------------------------------------
Ïà¹ØÎĵµ£º
ͼ±í¿â
ÏÂÃæµÄÀà¿â¿ÉÒÔÈÃÄãºÜ¼òµÄ´´½¨¸´ÔÓµÄͼ±íºÍͼƬ¡£µ±È»£¬ËüÃÇÐèÒªGD¿âµÄÖ§³Ö¡£
pChart - Ò»¸ö¿ÉÒÔ´´½¨Í³¼ÆͼµÄ¿â¡£
Libchart - ÕâÒ²ÊÇÒ»¸ö¼òµ¥µÄͳ¼Æͼ¿â¡£
JpGraph - Ò»¸öÃæÏò¶ÔÏóµÄͼƬ´´½¨Àà¡£
Open Flash Chart - ÕâÊÇÒ»¸ö»ùÓÚFlashµÄͳ¼Æͼ¡£
RSS ½âÎö
½âÊÍRSS²¢ÊÇÒ»¼þºÜµ¥µ÷µÄÊÂÇé£ ......
¡¡¡¡×î½üÔÚ×ö¸öÒ³Ãæʱ£¬Óöµ½ÒªPHP³ÌÐòÖÐʵÏÖÑÓ³Ùµ±Ç°½ø³ÌÎÊÌâ¡£ÓÉÓÚ½Ó´¥PHPʱ¼äÓÐÏÞ£¬Ï뵱ȻµÄÈÏΪPHPÖÐʵÏִ˹¦Äܵĺ¯ÊýÒ²ÊÇsleep()¡£ÊÂʵÉÏ£¬ÔÚPHPÖеÄÈ·ÓÐÕâ¸öº¯Êý£¬µ«ÔÚÎÒ³¢ÊÔÁË°ëÌìºó£¬È´Ê¼ÖÕ²»ÄÜʵÏÖÎÒÒªµÄÂß¼¡£PHP5ÊÖ²áÖУ¬¶ÔÕâ¸öº¯ÊýÊÇÕâÑùÃèÊöµÄ£ºsleep -- Delay execution¡£µ±ÎÒ°Ù¶ÈÁËÒԺ󣬲ÅÖªµÀÕ⸠......
Õ⼸Ì죬ÏîÄ¿ÖÐÓиöÐèÇ󣬵½Êý¾Ý¿âÕâ²½µÄ½á¹û¾ÍÊÇÐèÒªÅúÁ¿updateµÄÊý¾Ý£¬×ܲ»ÄÜÑ»·Ê¹ÓÃupdate....set...°É£¬ÕâÑùÏÔʾЧÂÊÊǺܵͣ¬ÎªÁ˽â¾öÕâ¸öÎÊÌ⣬´ó¼ÒÒ²ÊÇÏëÁ˺ܶàµÄ°ì·¨¡£
ÏÈ˵Õ⼸¸ö½â¾ö·½°¸£º
1£ºÑ»·update²Ù×÷£ºÊ²Ã´¶¼²»ËµÁË£¬ÏÔÈ»ÌÔÌÁË£»
2£º ......
1. дһ¸öº¯Êý£¬¾¡¿ÉÄܸßЧµÄ£¬´ÓÒ»¸ö±ê×¼ url
ÀïÈ¡³öÎļþµÄÀ©Õ¹Ãû
ÀýÈç: http://www.sina.com.cn/abc/de/fg.php
?id=1
ÐèҪȡ³ö php »ò .php
2. ÔÚ HTML ÓïÑÔÖУ¬Ò³ÃæÍ·²¿µÄ meta ±ê¼Ç¿ÉÒÔÓÃÀ´Êä³öÎļþµÄ±àÂë
¸ñʽ£¬ÒÔÏÂÊÇÒ»¸ö±ê×¼µÄ meta Óï¾ä
<META http-equiv='Content-Type
' ......
Óï·¨½á¹¹½Ì¿ÆÊéÉϵÄ֪ʶºÍʵ¼ÊµÄ³ÌÐòÉè¼ÆÊÇÓÐÇø±ðµÄ£¬ÕæÕýµÄ֪ʶҪÔÚʵ¼ÊµÄ¿ª·¢ÖлñµÃ¡£Ã¿¸öphpµÄ¿ª·¢ÈËÔ±ÔÚ¿ªÊ¼¿ª·¢webÓ¦ÓóÌÐò֮ǰ£¬¶¼Ó¦¸ÃÊìϤÏÂÃæµÄÎå¼þÊ£º www.phperz.com
1. ¿ò¼Ü
php³ÌÐòÔ±Ö®¼Ò
¿ò¼Ü¿ÉÒÔ˵ÊÇphp¿ª·¢ÖеÄÒ»¸ö×îÖØÒªµÄÎÊÌâ¡£ÓÃphp¿ª·¢webÓ¦ÓóÌÐòʱÓкܶ෽·¨£¬Óкܶ࿪ԴµÄ¿ò¼Ü¿ÉÒÔʹÓã¬¿É ......