第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

建議老師分享一下源碼和筆記,包括添加和刪除

老師講得好,缺少源碼和筆記,還有添加和刪除,我想下載來(lái),好好研究學(xué)習(xí)

正在回答

7 回答

親,是的這個(gè)是xhtml的標(biāo)準(zhǔn)寫(xiě)法,我們的是html標(biāo)準(zhǔn),我們會(huì)在后面加一小節(jié)說(shuō)明一個(gè)兩者的區(qū)別bottom錯(cuò)?

0 回復(fù) 有任何疑惑可以回復(fù)我~

//連接數(shù)據(jù)庫(kù)

$db_host='localhost';

$db_user="root";

$db_password="";

$db_name="imooc";


$link=mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());

mysql_select_db($db_name,$link);

mysql_query("set names utf8") or die("編碼設(shè)置錯(cuò)誤!");


1 回復(fù) 有任何疑惑可以回復(fù)我~

# php無(wú)限分類下拉列表的 ?數(shù)據(jù)庫(kù)創(chuàng)建

//在數(shù)據(jù)庫(kù)imooc下 創(chuàng)建表 deepcate

create table deepcate

(

id int(10) unsigned not null ?auto_increment primary key,

pid int(11) unsigned not null,

catename varchar(30) not null,

cateorder int(11) unsigned default 0,

createtime int(10) not null

);


insert into deepcate(pid,catename,cateorder,createtime)values(0,'新聞',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(0,'圖片',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(1,'國(guó)內(nèi)新聞',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(1,'國(guó)際新聞',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(3,'北京新聞',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(4,'美國(guó)新聞',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(2,'美女圖片',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(2,'風(fēng)景圖片',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(7,'日韓明星',0,0);

insert into deepcate(pid,catename,cateorder,createtime)values(9,'日本AV',0,0);


select * from deepcate;


1 回復(fù) 有任何疑惑可以回復(fù)我~

<?php

header("Content-Type:text/html;Charset=UTF-8");

//?php無(wú)限分類下拉列表的代碼實(shí)現(xiàn)

include_once('db.inc.php') ;


function getList($pid=0,&$result=array(),$spac=0)

{

? ? $spac=$spac+2;

? ? $sql=" SELECT * FROM deepcate WHERE pid=$pid ";

? ? $res=mysql_query($sql);

? ?

? ? while($row=mysql_fetch_assoc($res)){

? ? ? ? $row['catename']=str_repeat('&nbsp;&nbsp;',$spac).'|--'.$row['catename'];

? ? ? ? $result[]=$row;

? ? ? ? getList($row['id'],$result,$spac);

? ? }

? ? return $result;

}


function displayCate($pid=0,$selected=0){

? ? ?$rs=getList($pid);

? ? ?$str="";

? ? ?$str.="<select name='cate'>";

? ? foreach($rs as $v){

? ? ? ? if($v['id']==$selected){

? ? ? ? ? ? $selected="selected";

? ? ? ? }

? ? ? ?$str.="<option {$selected}>";

? ? ? ?$str.= $v['catename'];

? ? ? ?$str.= "</option>";

? ? }

? ? return $str.= "</select>";

}


echo displayCate();


echo "<hr/><hr/>";

function getCatePath($cid,&$result){

? ? $sql="SELECT * FROM deepcate WHERE id=$cid ";

? ? $rs=mysql_query($sql);

? ? $row=mysql_fetch_assoc($rs);

? ? if($row){

? ? ? ? $result[]=$row;

? ? ? ? getCatePath($row['pid'],$result);

? ? }

? ? krsort($result);

? ? return $result;

}



function displayCatePath($cid,$url="deepcate.php?cid="){

? ? $res=getCatePath($cid,$result);

? ? $str="";

? ? foreach($res as $v){

? ? ? ? $str.= "<a href='{$url}{$v['id']}'>{$v['catename']}</a>>>";

? ? }return $str;

}


echo displayCatePath(10);


1 回復(fù) 有任何疑惑可以回復(fù)我~

#在數(shù)據(jù)庫(kù)imooc下創(chuàng)建表likecate

#遞歸無(wú)限分類原理 數(shù)據(jù)庫(kù)創(chuàng)建

use imooc;

create table likecate

(

id int(11) not null ?auto_increment primary key,

path varchar(200) not null,

catename varchar(30) not null,

cateorder int(11) not null default 0,

createtime int(11) not null

);


insert into likecate(path,catename,cateorder,createtime)values('','手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1','功能手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1,2','老人手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1,2','兒童手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1','智能手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1,5','andriod手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1,5','ios手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1,5','winphoto手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1,2,4','色盲手機(jī)',0,0);

insert into likecate(path,catename,cateorder,createtime)values('1,2,3','大字手機(jī)',0,0);


select * from likecate;


select id,catename,path,concat(path,',',id) as fullpath from likecate where 1 order by fullpath asc;


#結(jié)果顯示如圖

+----+--------------+-------+----------+

| id | catename ? ? | path ?| fullpath |

+----+--------------+-------+----------+

| ?1 | 手機(jī) ? ? ? ? | ? ? ? | ,1 ? ? ? |

| ?2 | 功能手機(jī) ? ? | 1 ? ? | 1,2 ? ? ?|

| ?3 | 老人手機(jī) ? ? | 1,2 ? | 1,2,3 ? ?|

| 10 | 大字手機(jī) ? ? | 1,2,3 | 1,2,3,10 |

| ?4 | 兒童手機(jī) ? ? | 1,2 ? | 1,2,4 ? ?|

| ?9 | 色盲手機(jī) ? ? | 1,2,4 | 1,2,4,9 ?|

| ?5 | 智能手機(jī) ? ? | 1 ? ? | 1,5 ? ? ?|

| ?6 | andriod手機(jī) ?| 1,5 ? | 1,5,6 ? ?|

| ?7 | ios手機(jī) ? ? ?| 1,5 ? | 1,5,7 ? ?|

| ?8 | winphoto手機(jī) | 1,5 ? | 1,5,8 ? ?|

+----+--------------+-------+----------+



1 回復(fù) 有任何疑惑可以回復(fù)我~
<?php
header("Content-Type:text/html;Charset=UTF-8");
//遞歸無(wú)限分類原理
include_once?('db.inc.php');

function?likecate(){
????$sql="select?id,catename,path,concat(path,',',id)?as?fullpath?from?likecate?where?1?order?by?fullpath?asc";
????$res=mysql_query($sql);
????$result=array();
????while($row=mysql_fetch_assoc($res)){
????????$deep=count(explode(',',trim($row['fullpath'],',')));
????????
????????$row['catename']=str_repeat('&nbsp;&nbsp;',$deep*4).'|--'.$row['catename'];
????????$result[]=$row;
????}
????return?$result;
}


$res=likecate();
echo?"<select?name='cate'>";
foreach($res?as?$v){
????echo?"<option>{$v['catename']}</option>";
}
echo?"</select>";

echo?"<hr/><hr/>";
function?getPathCate($cateid){
????$sql="select?*,concat(path,',',id)fullpath?from?likecate?where?id=$cateid";
????$res=mysql_query($sql);
????$row=mysql_fetch_assoc($res);
????$ids=$row['fullpath'];
????$sql="select?*?from?likecate?where?id?in($ids)?order?by?id?asc";
????$res=mysql_query($sql);
????$result=array();
????while($row=mysql_fetch_assoc($res)){
????????$result[]=$row;
????}
????return?$result;
}

function?displayCatePath($cateid,$link='likecate.php?cid='){
????$res=getPathCate($cateid);
????$str="";
????foreach($res?as?$v){
????????$str.="<a?href='{$link}'>{$v['catename']}</a>>";
????}
????return?$str;
}??

echo?displayCatePath(4,'likecate.php?p=1&cid=');


1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

建議老師分享一下源碼和筆記,包括添加和刪除

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)