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>
--------------------------------------------------------
Ïà¹ØÎĵµ£º
¡¡¡¡×î½üÔÚ×ö¸öÒ³ÃæÊ±£¬Óöµ½ÒªPHP³ÌÐòÖÐʵÏÖÑÓ³Ùµ±Ç°½ø³ÌÎÊÌâ¡£ÓÉÓÚ½Ó´¥PHPʱ¼äÓÐÏÞ£¬Ï뵱ȻµÄÈÏΪPHPÖÐʵÏִ˹¦Äܵĺ¯ÊýÒ²ÊÇsleep()¡£ÊÂʵÉÏ£¬ÔÚPHPÖеÄÈ·ÓÐÕâ¸öº¯Êý£¬µ«ÔÚÎÒ³¢ÊÔÁ˰ëÌìºó£¬È´Ê¼ÖÕ²»ÄÜʵÏÖÎÒÒªµÄÂß¼¡£PHP5ÊÖ²áÖУ¬¶ÔÕâ¸öº¯ÊýÊÇÕâÑùÃèÊöµÄ£ºsleep -- Delay execution¡£µ±ÎÒ°Ù¶ÈÁËÒԺ󣬲ÅÖªµÀÕ⸠......
grant replication slave on *.* to 'guest'@'192.168.1.%' identified by '123456'
change master to master_host='192.168.1.190',master_user='guest',master_password='123456',master_port=3306
mysql> change master to master_host='192.168.1.190',master_user='guest',master_password='123456',master_log ......
<?php
//$str = "abcdef¡ôÖлªÈËÃñ¹²ºÍ¹ú";
//$str = "1234567890";
$str = "ÖлªÈËÃñ¹²ºÍ¹úabcÖлªÈËÃñ¹²ºÍ¹úÖлªÈËÃñ¹²ºÍ¹ú";
$str = cut_str($str, 18);
echo $str;
function cut_str($str, $len){
if(strlen($str) <= $len) return $str;
$n = 0;
$tempstr = '';
for($i = 0; ......
Ò».Ê×ÏÈÊÇPHPÍøÒ³µÄ±àÂë
¡¡¡¡1.phpÎļþ±¾ÉíµÄ±àÂëÓëÍøÒ³µÄ±àÂëӦƥÅä
¡¡¡¡a.Èç¹ûÓûʹÓÃgb2312±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; charset=gb2312")£¬¾²Ì¬Ò³ÃæÌí¼Ó£¬ËùÓÐÎļþµÄ±àÂë¸ñʽΪANSI£¬¿ÉÓüÇʱ¾´ò¿ª£¬Áí´æÎªÑ¡Ôñ±àÂëΪANSI£¬¸²¸ÇÔ´Îļþ¡£
¡¡¡¡b.Èç¹ûÓûʹÓÃutf-8±àÂ룬ÄÇôphpÒªÊä³ ......
¼òÊöÌâ(50·Ö)()
1¡¢ÓÃPHP´òÓ¡³öǰһÌìµÄʱ¼ä¸ñʽÊÇ2006-5-10 22:21:21(2·Ö)
echo date('Y-m-d H:i:s', strtotime('-1 day'));
»òÕß
$yesterday = time() - (24 * 60 * 60);
echo 'today:'.date('Y-m-d H:i:s')."\n";
echo 'yesterday:'. date('Y-m-d H:i:s', $yesterday)."\n";
2¡¢echo(),pr ......