Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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>
--------------------------------------------------------
 


Ïà¹ØÎĵµ£º

ÅäÖÃeclipseµÄphp¿ª·¢²å¼þ

ÏÈÏÂÔز¢°²×°eclipse£¬ÏÂÔصØÖ·£ºhttp://download.Eclipse.org/downloads/index.php¡£Eclipse ÐèÒª jre µÄÖ§³Ö£¬ËùÒÔÈç¹û»úÆ÷ÉÏ»¹Ã»×°jreµÄ»°¾Í¸Ï¿ìÈ¥ÏÂÔØÒ»¸ö×°ÉÏ£¬http://java.sun.comÓÐjreµÄÏÂÔØ¡£
µÚ¶þ£¬ÏÂÔز¢°²×° PHP ÔÚ Eclipse µÄ²å¼þ
µØÖ·£ºhttp://sourceforge.net/project/showfiles.php?group_id=57621&pa ......

¹ØÓÚmysqlÖеÄinsert

    Õ⼸Ì죬ÏîÄ¿ÖÐÓиöÐèÇ󣬵½Êý¾Ý¿âÕâ²½µÄ½á¹û¾ÍÊÇÐèÒªÅúÁ¿updateµÄÊý¾Ý£¬×ܲ»ÄÜÑ­»·Ê¹ÓÃupdate....set...°É£¬ÕâÑùÏÔʾЧÂÊÊǺܵͣ¬ÎªÁ˽â¾öÕâ¸öÎÊÌ⣬´ó¼ÒÒ²ÊÇÏëÁ˺ܶàµÄ°ì·¨¡£
   ÏÈ˵Õ⼸¸ö½â¾ö·½°¸£º
   1£ºÑ­»·update²Ù×÷£ºÊ²Ã´¶¼²»ËµÁË£¬ÏÔÈ»ÌÔÌ­ÁË£»
   2£º ......

ÐÂÀËPHP¹¤³Ìʦ±ÊÊÔÌâ

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¿ª·¢ÈËÔ±Ó¦ÊìϤµÄÎå¸ö¸ÅÄî

Óï·¨½á¹¹½Ì¿ÆÊéÉϵÄ֪ʶºÍʵ¼ÊµÄ³ÌÐòÉè¼ÆÊÇÓÐÇø±ðµÄ£¬ÕæÕýµÄ֪ʶҪÔÚʵ¼ÊµÄ¿ª·¢ÖлñµÃ¡£Ã¿¸öphpµÄ¿ª·¢ÈËÔ±ÔÚ¿ªÊ¼¿ª·¢webÓ¦ÓóÌÐò֮ǰ£¬¶¼Ó¦¸ÃÊìϤÏÂÃæµÄÎå¼þÊ£º www.phperz.com

1. ¿ò¼Ü

php³ÌÐòÔ±Ö®¼Ò
¿ò¼Ü¿ÉÒÔ˵ÊÇphp¿ª·¢ÖеÄÒ»¸ö×îÖØÒªµÄÎÊÌâ¡£ÓÃphp¿ª·¢webÓ¦ÓóÌÐòʱÓкܶ෽·¨£¬Óкܶ࿪ԴµÄ¿ò¼Ü¿ÉÒÔʹÓã¬¿É ......

PHPÃæÊÔÌâ»ã×Ü

»ù´¡Ìâ
¡¡¡¡1.±íµ¥ÖÐ getÓëpostÌá½»·½·¨µÄÇø±ð?
¡¡¡¡´ð£ºgetÓû§¶Ë½«Êý¾Ý¼Óµ½URLºó£¬¸ñʽΪ”?×Ö¶Î1=ÊäÈëÊý¾Ý1&×Ö¶Î2=ÊäÈëÊý¾Ý2&..."¡£
¡¡¡¡ÓÉÓÚgetÌá½»²ÎÊýºó»áÔÚµØÖ·À¸ÖÐÏÔʾ³öÀ´£¬ËùÒÔ»á²úÉúÑÏÖصݲȫÎÊÌâ¡£
¡¡¡¡get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬ÕâÖ÷ÒªÊÇÒòΪÊÜurl³¤¶ÈÏÞÖÆ;¶øpost¿ÉÒÔ´«Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ