ホームページ >バックエンド開発 >PHPチュートリアル >PHP で無制限の階層クラスを作成する (完全なコードとコメント)_PHP チュートリアル
以下は、PHP での無限の採点クラスのコードを提供します。無制限の採点クラスを実現したい友人は、それを試してみてください。コードを直接コピーする場合は、山括弧を使用できるため、置き換える必要があるため、バグはチェックされ修正されています。
1. データベース ProductShow に b_mtype テーブルがあります。テーブル作成ステートメントは次のとおりです。
2. ProductClass.php コード: 直接コピーしてください)<ol class="dp-c"> <li class="alt"><span><span>< html> </SPAN></SPAN><LI class=""><SPAN>< 頭> </SPAN><LI class=alt><SPAN>< meta http-equiv=</SPAN><SPAN class=string><FONT color=#0000ff>"Content-Type"</FONT></SPAN><SPAN> content=</SPAN><SPAN class=string><FONT color=#0000ff>"text/html; charset=gb2312"</FONT></SPAN><SPAN> /> </span></span></li> <li class=""><span>< タイトル>WHB_PHP無制限级分类< /タイトル> </SPAN><LI class=alt><SPAN>< style type=</SPAN><SPAN class=string><FONT color=#0000ff>"text/css"</FONT></SPAN><SPAN>> </span></li> <li class=""><span>< !-- </SPAN><LI class=alt><SPAN>.STYLE1 {color: #FF0000} </SPAN><LI class=""><SPAN>body,td,th { </SPAN><LI class=alt><SPAN> font-family: 宋体; </SPAN><LI class=""><SPAN> font-size: 12px; </SPAN><LI class=alt><SPAN>} </SPAN><LI class=""><SPAN>.STYLE2 { </SPAN><LI class=alt><SPAN> color: #FFFFFF; </SPAN><LI class=""><SPAN> font-size: 14px; </SPAN><LI class=alt><SPAN> font-weight: 太字; </SPAN><LI class=""><SPAN>}</SPAN><LI class=alt><SPAN>--> /style></span></li> <li class=""><span></span></li> <li class="alt">< <SPAN></SPAN>(<LI class=""> <SPAN></SPAN>「エラー報告」<LI class=alt><SPAN></SPAN>, <LI class=""><SPAN></SPAN>"E_ALL & ~E_NOTICE"<LI class=alt><SPAN></SPAN>);<SPAN class=func></SPAN><SPAN>//すべての警告メッセージを無視します </SPAN><SPAN class=string><FONT color=#0000ff></FONT></SPAN><SPAN></SPAN><SPAN class=string> <FONT color=#0000ff></FONT></SPAN>require_once<SPAN></SPAN><SPAN class=comment> <FONT color=#008200>(</FONT> </SPAN><SPAN>"conn.php"</SPAN></SPAN> <LI class="">);<SPAN></SPAN><SPAN class=keyword>//埋め込み接続ファイル<STRONG><FONT color=#006699></FONT></STRONG></SPAN><SPAN></SPAN> @<SPAN class=string><FONT color=#0000ff></FONT>$ToDo</SPAN><SPAN></SPAN>=<SPAN class=comment><FONT color=#008200></FONT>$_ GET</SPAN><SPAN></SPAN>[</SPAN><LI class=alt>] <SPAN>「ToDo」</SPAN><SPAN class=vars><FONT color=#dd0000>]; </FONT></SPAN><SPAN> { ����������</SPAN><SPAN class=vars><FONT color=#dd0000>������</FONT></SPAN><SPAN></SPAN>case<SPAN class=string><FONT color=#0000ff></FONT></SPAN><SPAN></SPAN></SPAN> "追加"<LI class=""><SPAN></SPAN>: <SPAN class=keyword><STRONG><FONT color=#006699></FONT> </STRONG></SPAN>エコー<SPAN></SPAN>追加(); <SPAN class=vars><FONT color=#dd0000>; </FONT></SPAN><SPAN> </SPAN></SPAN><LI class=alt> <SPAN></SPAN><LI class=""><SPAN>ケース</SPAN><SPAN class=keyword><STRONG><FONT color=#006699> </FONT></STRONG></SPAN>「編集」<SPAN></SPAN><SPAN class=string>: <FONT color=#0000ff></FONT></SPAN><SPAN> </SPAN> </SPAN>エコー<LI class=alt><SPAN>編集(); </SPAN><SPAN class=func></SPAN><SPAN></SPAN></SPAN> <LI class=""><SPAN></SPAN> <SPAN class=keyword><STRONG><FONT color=#006699>"saveadd"</FONT></STRONG></SPAN>: <SPAN></SPAN></SPAN><LI class=alt> <SPAN></SPAN>echo<LI class=""><SPAN> saveadd(); </SPAN><SPAN class=keyword><STRONG>休憩<FONT color=#006699></FONT></STRONG></SPAN>; <SPAN> </SPAN><SPAN class=string><FONT color=#0000ff> </FONT>case</SPAN><SPAN></SPAN></SPAN> <LI class=alt><SPAN></SPAN>"saveedit"<SPAN class=func></SPAN><SPAN>: </SPAN></SPAN><LI class=""><SPAN> </SPAN><SPAN class=keyword>echo<STRONG><FONT color=#006699> saveedit(); </FONT></STRONG></SPAN><SPAN></SPAN></SPAN>休憩<LI class=alt><SPAN></SPAN><LI class="">; <SPAN> </SPAN><SPAN class=keyword><STRONG> <FONT color=#006699></FONT></STRONG></SPAN>case<SPAN></SPAN><SPAN class=string><FONT color=#0000ff> </FONT></SPAN><SPAN>"del"</SPAN></SPAN><LI class=alt>: <SPAN></SPAN><SPAN class=func></SPAN> <SPAN></SPAN>echo</SPAN><LI class=""> del(); <SPAN></SPAN><SPAN class=keyword><STRONG><FONT color=#006699></FONT></STRONG></SPAN>休憩<SPAN></SPAN></SPAN><LI class=alt>; <SPAN></SPAN><LI class=""><SPAN> </SPAN><SPAN class=keyword><STRONG> <FONT color=#006699></FONT></STRONG></SPAN>デフォルト<SPAN></SPAN></SPAN><SPAN>: </SPAN></SPAN><LI class=alt><SPAN>?> </li> <li class=""><span> </span></li> <li class="alt"><span>< table width=</SPAN><SPAN class=string><FONT color=#0000ff>"90%"</FONT></SPAN><SPAN> border=</SPAN><SPAN class=string><FONT color=#0000ff>"0"</FONT></SPAN><SPAN> align=</SPAN><SPAN class=string><FONT color=#0000ff>"center"</FONT></SPAN><SPAN> cellpadding=</SPAN><SPAN class=string><FONT color=#0000ff>"0"</FONT> </SPAN><SPAN> セル間隔=</SPAN><SPAN class=string> <FONT color=#0000ff>"0"</FONT></SPAN><SPAN> </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>クラス</FONT></STRONG></SPAN><SPAN>=</SPAN><SPAN class=string><FONT color=#0000ff>"tblborder"</FONT></SPAN><SPAN>> </SPAN></SPAN><LI class=""><SPAN>< tr> </SPAN><LI class=alt><SPAN> < td valign=</SPAN><SPAN class=string><FONT color=#0000ff>"トップ"</FONT></SPAN><SPAN>>< table width=</SPAN><SPAN class=string><FONT color=#0000ff>"100%"</FONT></SPAN><SPAN> border=</SPAN><SPAN class=string><FONT color=#0000ff>"0"</FONT></SPAN><SPAN> cellspacing=</SPAN><SPAN class=string><FONT color=#0000ff>"1"</FONT></SPAN><SPAN> cellpadding=</SPAN><SPAN class=string><FONT color=#0000ff>"3" </FONT></SPAN><SPAN>> </SPAN></SPAN><LI class=""><SPAN> < tr> </SPAN><LI class=alt><SPAN> < td幅=</SPAN><SPAN class=string><FONT color=#0000ff>"55%"</FONT></SPAN><SPAN>高さ=</SPAN><SPAN class=string><FONT color=#0000ff>"20"</FONT></SPAN><SPAN>align=</SPAN><SPAN class=string><FONT color=#0000ff>"center"</FONT></SPAN><SPAN>bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#698FC7" </FONT></SPAN><SPAN>>< ; スパン</SPAN><SPAN class=keyword><STRONG><FONT color=#006699>クラス</FONT></STRONG></SPAN><SPAN>=</SPAN><SPAN class=string><FONT color=#0000ff>"tblhead"</FONT></SPAN><SPAN>>< b><; スパン</SPAN><SPAN class=keyword><STRONG><FONT color=#006699>クラス</FONT></STRONG></SPAN><SPAN>=</SPAN><SPAN class=string><FONT color=#0000ff>"STYLE2"</FONT></SPAN><SPAN>>商品カテゴリの設定< a href=</SPAN><SPAN class=string><FONT color=#0000ff>"?ToDo=add"</FONT></SPAN>> < /span>< /td> <span></span> bgcolor=</span></li> <li class=""><span>"#cccccc" </span></li> <li class="alt"><span>セルスペース=</span></li> <li class=""><span>"1"</span></li> <li class="alt"> <span>セルパディング=</span><span class="string"><font color="#0000ff">"3"</font></span><span> > </span> <span class="string"><font color="#0000ff"></font> </span>"#F9F9F9"<span></span> <span class="string">> <font color="#0000ff">>ID< /td> </FONT> < </SPAN><SPAN>> 並べ替え/tr> </SPAN><SPAN class=string><FONT color=#0000ff> < ?php </FONT></SPAN><SPAN> </SPAN></SPAN> <LI class=""> <SPAN></SPAN><SPAN class=string>$query<FONT color=#0000ff></FONT></SPAN>=mysql_query(<SPAN></SPAN></SPAN>"select * from b_mtype order by rootid,orders" <LI class=alt><SPAN></SPAN>); <SPAN class=string><FONT color=#0000ff></FONT></SPAN><SPAN></SPAN><SPAN class=string><FONT color=#0000ff>while</FONT></SPAN><SPAN></SPAN>(</SPAN><LI class=""><SPAN>$arr </SPAN><SPAN class=string><FONT color=#0000ff>=mysql_fetch_array(</FONT></SPAN><SPAN>$query</SPAN></SPAN><LI class=alt>)) <SPAN></SPAN><SPAN class=string><FONT color=#0000ff> { </FONT></SPAN><SPAN> ?> FFFFFF"</font></span> </li> <li class="">>< ?php <SPAN></SPAN>echo<SPAN class=string><FONT color=#0000ff> </FONT></SPAN><SPAN>$arr</SPAN></SPAN><LI class=alt>[<SPAN></SPAN><LI class="">"typeid"<SPAN></SPAN><LI class=alt>];?>< /td> <span></span> </li> <li class=""> <span> td bgcolor =</span><span class="vars"><font color="#dd0000">"#FFFFFF"</font></span><span>>< ?php </SPAN><SPAN class=string><FONT color=#0000ff></FONT>if</SPAN><SPAN></SPAN></SPAN> (<LI class=alt><SPAN></SPAN>$arr<SPAN class=keyword><STRONG><FONT color=#006699>[</FONT></STRONG> </SPAN>"深さ"<SPAN>) </SPAN><SPAN class=vars>]>0) { <FONT color=#dd0000></FONT></SPAN><SPAN></SPAN><SPAN>(</SPAN><SPAN class=vars><FONT color=#dd0000>$i</FONT></SPAN><SPAN>=1;</SPAN><SPAN class=vars><FONT color=#dd0000>$i</FONT></SPAN><SPAN><=</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"深さ"</FONT></SPAN> <SPAN>];</SPAN><SPAN class=vars><FONT color=#dd0000>$i </FONT></SPAN><SPAN>++){ </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string><FONT color=#0000ff>" "</FONT></SPAN><SPAN>;} </SPAN></SPAN><LI class=alt><SPAN> }?> </span> </li> <li class=""><span> </span></li> <li class="alt"><span> < ? </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>if</FONT></STRONG></SPAN><SPAN>(</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"子供"</FONT></SPAN><SPAN>]>0) { </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string><FONT color=#0000ff>"+"</FONT></SPAN><SPAN>;} </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>else</FONT></STRONG></SPAN><SPAN> {</SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string><FONT color=#0000ff>"-"</FONT></SPAN><SPAN>;}?> </span></li> <li class=""> <span> < ? </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>if</FONT></STRONG></SPAN><SPAN>(</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"parentid"</FONT></SPAN><SPAN>]==0) { </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN> <SPAN class=string><FONT color=#0000ff>「< b>」</span> <span>;}?> </span> </li> <li class="alt"><span> < ? </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"typename"</FONT></SPAN><SPAN>];?> </span></li> <li class=""> <span> < ? </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>if</FONT></STRONG></SPAN><SPAN> (</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"子供"</FONT></SPAN><SPAN>]>0) {?>(< ? </SPAN><SPAN class=func>echo </SPAN><SPAN> </SPAN><SPAN class=vars><FONT color=#dd0000>$ arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>「子供」</FONT></SPAN><SPAN>];?>)< ? }?>< /td> </SPAN></SPAN><LI class=alt><SPAN> < td bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>>< ?php </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"注文"</FONT></SPAN><SPAN>];?>< /td> </SPAN></SPAN><LI class=""><SPAN> < td bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>>< a href=</SPAN><SPAN class=string><FONT color=#0000ff>"?ToDo=add&editid=<?php echo $arr["</FONT></SPAN><SPAN>typeid</SPAN><SPAN class=string><FONT color=#0000ff>"];?>"</span><span>>< U>添加子类<; /U>< /a> </SPAN></SPAN><LI class=alt><SPAN> | <; a href=</SPAN><SPAN class=string><FONT color=#0000ff>"?ToDo=edit&editid=<?php echo $arr["</FONT></SPAN><SPAN>typeid</SPAN><SPAN class=string><FONT color=#0000ff>"]?>"</span><span>>< U>编辑类别< /U>< /a> </SPAN></SPAN><LI class=""><SPAN> | <; ? </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>if</FONT></STRONG></SPAN><SPAN>(</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"子供"</FONT></SPAN><SPAN>]==0){?>< a href=</SPAN><SPAN class=string><FONT color=#0000ff>"?ToDo=del&editid=< ? echo $arr["</FONT></SPAN><SPAN>typeid</SPAN><SPAN class=string><FONT color=#0000ff>"];?>"</span><span> onClick=</span><span class="string"><font color="#0000ff">"{if(confirm('删除类時、このクラスの下のすべての商品は一并被除除、确定删除吗?')){return true;}return false;}"</font></span><span>>< U>删除类别< /U>< /a>< ?}</SPAN><SPAN class=keyword><STRONG><FONT color=#006699>else</FONT></STRONG></SPAN><SPAN>{?>< a href=</SPAN><SPAN class=string><FONT color=#0000ff>"#"</FONT></SPAN><SPAN> onClick=</SPAN><SPAN class=string><FONT color=#0000ff>"{if(confirm('该类别含有下属类别,必须先删除その下属类别方能删除本类别!')){return true;}return false;}「</FONT></SPAN><SPAN>>< U>删除类别< /U>< /a>< ?}?> < /td> </span> </li> <li class="alt"><span> < /tr> </SPAN><LI class=""> < ?php <SPAN></SPAN> ?>テーブル> <li class="alt"> <span></span> < /td> </li> <li class=""> <span> < /tr> </span>< /table> </li> <li class="alt"> <span></span>< ?php <LI class=""><SPAN> </SPAN><LI class=alt><SPAN>休憩</SPAN><LI class=""><SPAN> } </SPAN><LI class=""><SPAN> ?> </li></span></li> <li class="alt"><span> </span></li> <li class=""><span> </span></li> <li class="alt"><span>< ?php </SPAN><SPAN class=comment><FONT color=#008200>///增加类别 </FONT></SPAN><SPAN> </SPAN></SPAN><LI class=""><SPAN></SPAN><SPAN class=keyword><STRONG><FONT color=#006699>function</FONT></STRONG></SPAN><SPAN> add(){ </SPAN></SPAN><LI class=alt><SPAN> @ </SPAN><SPAN class=vars><FONT color=#dd0000>$editid</FONT></SPAN><SPAN>=</SPAN><SPAN class=vars><FONT color=#dd0000>$_REQUEST</FONT> </SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"編集ID"</FONT></SPAN><SPAN>]; </SPAN></SPAN><LI class=""><SPAN>?> </span></li> <li class="alt"><span> < form name=</SPAN><SPAN class=string><FONT color=#0000ff>"form1"</FONT></SPAN><SPAN> method=</SPAN><SPAN class=string><FONT color=#0000ff>"post"</FONT></SPAN><SPAN> action=</SPAN><SPAN class=string><FONT color=#0000ff>"?ToDo=saveadd"</FONT></SPAN><SPAN>> </span></li> <li class=""><span> < table width=</SPAN><SPAN class=string><FONT color=#0000ff>"90%"</FONT></SPAN><SPAN> align=</SPAN><SPAN class=string><FONT color=#0000ff>"center"</FONT></SPAN><SPAN> cellpadding=</SPAN><SPAN class=string><FONT color=#0000ff>"3"</FONT></SPAN><SPAN> cellspacing=</SPAN><SPAN class=string><FONT color=#0000ff>"1" </FONT></SPAN><SPAN> bgcolor=</SPAN><SPAN class=string> <FONT color=#0000ff>「#CCCCCC」</FONT></SPAN><SPAN>> </SPAN></SPAN><LI class=alt><SPAN> < tr bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#CCCCCC"</FONT></SPAN><SPAN>> </span></li> <li class=""> <span> < td colspan=</SPAN><SPAN class=string><FONT color=#0000ff>"2"</FONT></SPAN><SPAN> align=</SPAN><SPAN class=string><FONT color=#0000ff>"center"</FONT></SPAN><SPAN> bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#698FC7"</FONT></SPAN><SPAN>>< スパン</span><span class="keyword"><strong><font color="#006699">クラス</font></strong></span><span>=</span><span class="string"><font color="#0000ff">"STYLE2"</font></span><span>< /span>< /td> </span> width=</li> <li class="alt"> <span></span>"25%"</li> <li class=""> <span> </span> bgcolor=</li> <li class="alt"> <span></span>"#FFFFFF" <span class="string"><font color="#0000ff"></font>>カテゴリ名: < dth=</span><span></span>"75%" <span class="string"><font color="#0000ff"></font> bgcolor=</span><span></span>"#FFFFFF"</li> <li class=""> <span><入力名=</span><span class="string"><font color="#0000ff">" </font></span><span> type=</span><span class="string"><font color="#0000ff">"text"</font></span><span>"typename" </span><span class="string"><font color="#0000ff">< /td> </font></span><span> < </SPAN><SPAN class=string><FONT color=#0000ff>"25%"</FONT> </SPAN><SPAN>身長= 30 bgcolor=</SPAN><SPAN class=string>"#FFFFFF"<FONT color=#0000ff></FONT></SPAN><U>カテゴリ</U></td><SPAN></SPAN></SPAN> bgcolor=<LI class=alt><SPAN> </SPAN> 「#FFFFFF」<LI class=""><SPAN></SPAN>> <LI class=alt><SPAN></SPAN><SPAN class=string> 0"<FONT color=#0000ff></FONT></SPAN>>メインカテゴリとして< /option> <SPAN></SPAN><SPAN class=string> <FONT color=#0000ff></FONT></SPAN>); <SPAN>$arr</SPAN></SPAN><LI class=""> =mysql_fetch_array(<SPAN></SPAN><SPAN class=string>$query<FONT color=#0000ff></FONT></SPAN>)){ ?> <span></span><span class="string"><font color="#0000ff"> value=</font></span><span>"< ? echo $arr["</SPAN> </SPAN><LI class=alt>typeid<SPAN></SPAN><LI class="">"]?> 「<span></span> <span class="string"> <font color="#0000ff"></font>$arr</span><span></span>[</span><li class="alt"> <span>'typeid'</span> </li> <li class=""> <span>]){ </span><span class="vars">echo<font color="#dd0000"></font> </span><span></span>" が選択されました"<span class="string"><font color="#0000ff"></font> }?>> </span> </li></span> </li> <li class="alt"><span> < ? </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>if</FONT></STRONG></SPAN><SPAN>(</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"深さ"</FONT></SPAN><SPAN>]>0) { </SPAN></SPAN><LI class=""><SPAN> </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>for</FONT></STRONG></SPAN><SPAN>(</SPAN><SPAN class=vars>) <FONT color=#dd0000>$i</FONT></SPAN><SPAN>=1;</SPAN><SPAN class=vars><FONT color=#dd0000>$i</FONT></SPAN><SPAN>< =</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"深さ"</FONT></SPAN><SPAN>];</SPAN><SPAN class=vars><FONT color=#dd0000>$私</FONT></SPAN><SPAN>++ ) </SPAN></SPAN><LI class=alt><SPAN> { </SPAN><LI class=""><SPAN> </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string><FONT color=#0000ff>"-"</FONT></SPAN><SPAN>; </SPAN></SPAN><LI class=alt><SPAN> } </SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN> }?> </span></li> <li class=""><span> < ? </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"typename"</FONT></SPAN><SPAN>]?>< /オプション> </SPAN></SPAN><LI class=alt><SPAN> < ? </SPAN><LI class=""><SPAN> } </SPAN><LI class=alt><SPAN> ?> </span></li> <li class=""><span> < /選択> </SPAN><LI class=alt><SPAN> < /td> </SPAN><LI class=""><SPAN> < /tr> </SPAN><LI class=alt><SPAN> < tr> </SPAN><LI class=""><SPAN> < td bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>> < /td> </SPAN></SPAN><LI class=alt><SPAN> < td bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>>< input type=</SPAN><SPAN class=string><FONT color=#0000ff>"送信"</FONT></SPAN><SPAN> name=</SPAN><SPAN class=string><FONT color=#0000ff>"送信"</FONT></SPAN><SPAN> value=</SPAN><SPAN class=string><FONT color=#0000ff>"保存"</FONT></SPAN><SPAN>> </span></li> <li class=""><span> < ラベル> </SPAN><LI class=alt><SPAN> < input type=</SPAN><SPAN class=string><FONT color=#0000ff>「ボタン」</FONT></SPAN><SPAN> name=</SPAN><SPAN class=string><FONT color=#0000ff>「キャンセル」</FONT></SPAN><SPAN> id=</SPAN><SPAN class=string><FONT color=#0000ff>「キャンセル」</FONT></SPAN><SPAN> value=</SPAN><SPAN class=string><FONT color=#0000ff>「返す」</FONT></SPAN> <SPAN> onclick=</SPAN><SPAN class=string><FONT color=#0000ff> "history.go(-1);"</FONT></SPAN><SPAN> /> </SPAN></SPAN><LI class=""><SPAN> < /ラベル>< /td> </SPAN><LI class=alt><SPAN> < /tr> </SPAN><LI class=""><SPAN> < /テーブル> </SPAN><LI class=alt><SPAN>< /フォーム> </SPAN><LI class=""><SPAN>< ? }?> </SPAN><LI class=alt> saveadd(){ <SPAN></SPAN><LI class=""><SPAN> </SPAN> <SPAN class=comment><FONT color=#008200></FONT></SPAN><SPAN>$query</SPAN></SPAN><LI class=alt>=mysql_query(<SPAN></SPAN><SPAN class=keyword>"select typeid from b_mtype order by typeid desc limit 1"<STRONG><FONT color=#006699> </FONT>); </STRONG> </SPAN><SPAN></SPAN>while</SPAN><LI class=""><SPAN></SPAN>(<LI class=alt><SPAN></SPAN> $arr<SPAN class=vars><FONT color=#dd0000></FONT>=mysql_fetch_array(</SPAN><SPAN></SPAN>$query<SPAN class=string><FONT color=#0000ff></FONT>)){</SPAN><SPAN></SPAN></SPAN> <LI class=""><SPAN></SPAN><SPAN class=keyword>if<STRONG><FONT color=#006699></FONT></STRONG> (! $arr</SPAN> <SPAN></SPAN>[<SPAN class=vars><FONT color=#dd0000></FONT>"typeid"</SPAN> <SPAN></SPAN>]){ <SPAN class=vars><FONT color=#dd0000></FONT></SPAN> <SPAN></SPAN></SPAN>$postnum<LI class=alt><SPAN></SPAN>=1; =<SPAN class=keyword><STRONG><FONT color=#006699>$arr</FONT></STRONG></SPAN>[<SPAN></SPAN> <SPAN class=vars>「typeid」<FONT color=#dd0000></FONT></SPAN>]+1 <SPAN></SPAN><SPAN class=string><FONT color=#0000ff> </FONT></SPAN><SPAN>} </SPAN></SPAN><LI class="">} <SPAN> </SPAN><SPAN class=vars><FONT color=#dd0000></FONT></SPAN><SPAN>if</SPAN></SPAN><LI class=alt><SPAN>(!</SPAN> <LI class=""><SPAN>$ポストナム</SPAN><SPAN class=keyword><STRONG>) <FONT color=#006699></FONT></STRONG>$ postnum</SPAN><SPAN></SPAN>=1; </SPAN><LI class=alt><SPAN></SPAN> <SPAN class=vars><FONT color=#dd0000>$postnum</FONT></SPAN><SPAN> </SPAN>$tn<SPAN class=vars><FONT color=#dd0000></FONT> =</SPAN><SPAN></SPAN>$_REQUEST <SPAN class=string><FONT color=#0000ff></FONT>[</SPAN><SPAN></SPAN>「タイプ名」</SPAN><LI class=""><SPAN> ]; </SPAN><LI class=alt><SPAN></SPAN><LI class=""><SPAN></SPAN>$btype <LI class=alt><SPAN></SPAN> =<SPAN class=keyword><STRONG><FONT color=#006699>$_REQUEST</FONT></STRONG></SPAN>[<SPAN> </SPAN><SPAN class=vars>"btype"<FONT color=#dd0000></FONT>]; </SPAN><SPAN></SPAN><SPAN class=vars><FONT color=#dd0000></FONT></SPAN><SPAN></SPAN></SPAN><LI class="">//エコー $btype; <SPAN>または</SPAN><LI class=alt><SPAN></SPAN><SPAN class=vars><FONT color=#dd0000></FONT>$tn</SPAN> <SPAN></SPAN>==<SPAN class=vars><FONT color=#dd0000> </FONT>""</SPAN><SPAN></SPAN>) </SPAN><LI class=""><SPAN></SPAN>{ <SPAN class=vars><FONT color=#dd0000></FONT></SPAN><SPAN>echo</SPAN><SPAN class=vars><FONT color=#dd0000></FONT></SPAN>"< script language='javascript'>"<span> </span><span class="string"><font color="#0000ff"></font></span> <span>echo</span></span></li> <li class="alt"> <span> </span>"alert('パラメータが間違っています。もう一度入力してください。!');"<span>; </span> </li> <li class=""> <span></span><span class="func">echo</span><span> </span><span class="string"><font color="#0000ff">"location.href='?';"</font></span><span></span> </li> <li class="alt"> <span></span>echo<span class="func">; </span> <span></span><span class="string">"< /script>"<font color="#0000ff"></font></span>; <span></span> </li> <li class=""> <span></span><span class="keyword"><strong>死ね<font color="#006699"></font></strong></span>(); <span></span> </li> <li class="alt">} <span></span> </li> <li class=""> <span></span> </li> <li class="alt"> <span></span><span class="keyword"><strong>if<font color="#006699"></font></strong></span> (<span></span><span class="vars">$btype <font color="#dd0000"></font></span>!=0){ <span></span> </li> <li class=""> <span></span> </li> <li class="alt"> <span></span><span class="vars">$result<font color="#dd0000"></font></span>=mysql_query(<span></span><span class="string">"select rootid,typeid, Depth,orders,parentstr b_mtype where typeid='$btype'" <font color="#0000ff"></font></span>); <span></span> </li> <li class=""> <span></span><span class="vars">$aa<font color="#dd0000"></font></span>=mysql_fetch_array(<span></span><span class="vars">$result<font color="#dd0000"></font></span>); <span></span> </li> <li class="alt"> <span></span><span class="vars">$rootid<font color="#dd0000"></font></span>=<span></span><span class="vars">$aa<font color="#dd0000"></font> </span>[<span></span><span class="string">'rootid'<font color="#0000ff"></font></span>]; <span></span> </li> <li class=""> <span></span>//echo "aaaaaaaaaa" <span class="comment"><font color="#008200"></font> </span><span></span> </li> <li class="alt"> <span></span>$parentid<span class="vars"><font color="#dd0000"></font>=</span><span></span>$aa<span class="vars"><font color="#dd0000"> </font>[</span><span></span>'typeid'<span class="string"><font color="#0000ff"></font>]; </span><span></span> </li> <li class=""> <span></span>$ Depth<span class="vars"><font color="#dd0000"></font>=</span><span></span>$aa<span class="vars"><font color="#dd0000"></font>[</span><span>] </span>「深さ」<span class="string"><font color="#0000ff"></font>]; </span><span></span> </li> <li class="alt"> <span></span>$orders<span class="vars"><font color="#dd0000"></font>=</span><span></span>$aa<span class="vars"><font color="#dd0000"></font>[</span><span></span>'orders'<span class="string"><font color="#0000ff"></font>]; </span><span></span> </li> <li class=""> <span></span>$parent str<span class="vars"><font color="#dd0000"></font>=</span><span></span>$aa<span class="vars"><font color="#dd0000"></font> [</span><span></span>'parentstr'<span class="string"><font color="#0000ff"></font>]; </span><span></span> </li> <li class="alt"> <span></span>//echo $rootid <span class="comment"><font color="#008200"></font> </span><span></span> </li> <li class=""><span> </span></li> <li class="alt"> <span></span>if<span class="keyword"><strong><font color="#006699"></font>((</strong></span><span>$ aa</span><span class="vars"><font color="#dd0000">[</font></span><span>"深さ"</span><span class="string"><font color="#0000ff">]+1)>20){ </font></span><span></span>die<span class="keyword"><strong><font color="#006699"></font>(</strong></span><span>"本分类制限最大只能有20级分)类「</span><span class="string">」 <font color="#0000ff">); } </font></span><span></span> </li> <li class=""><span>} </span></li> <li class="alt"><span> </span></li> <li class=""><span></span></li> <li class="alt"> <span></span>if<span class="keyword"><strong><font color="#006699"></font>(</strong></span><span>$ntid</span>) <span class="vars"><font color="#dd0000"> == </font></span><span>$btype</span><span class="vars"><font color="#dd0000">) </font></span><span> </span>{ </li> <li class=""><span></span></li> <li class="alt">エコー<span></span> <span class="func"></span><span>"< script language='javascript'>"</span><span class="string"><font color="#0000ff">; </font></span><span></span> </li> <li class="">echo<span></span> <span class="func"></span><span>"alert('您所指定のtypeid值重复!');"</span><span>; </span> </li> <li class="alt"> <span></span><span class="func">echo</span><span> </span><span class="string"><font color="#0000ff">"location.href='?';"</font></span><span></span> </li> <li class=""> <span></span>echo<span class="func">; </span> <span></span><span class="string">"< /script>"<font color="#0000ff"></font></span>; <span></span> </li> <li class="alt"> <span></span><span class="keyword"><strong>死ね<font color="#006699"></font></strong></span>(); <span></span> </li> <li class="">} <span></span> </li> <li class="alt"> <span></span> </li> <li class=""> <span></span><span class="keyword"><strong>if<font color="#006699"></font></strong></span>(<span></span><span class="vars">$btype <font color="#dd0000"></font></span>!=0){ <span></span> </li> <li class="alt"> <span></span> </li> <li class=""> <span></span><span class="vars">$奥行き<font color="#dd0000"></font></span>=<span></span><span class="vars">$奥行き<font color="#dd0000"></font></span>+1; <span></span> </li> <li class="alt"> <span></span><span class="vars">$rootid<font color="#dd0000"></font></span>=<span></span> <span class="vars">$rootid<font color="#dd0000"></font></span>; <span></span> </li> <li class=""> <span></span><span class="vars">$orders<font color="#dd0000"></font></span> =<span></span><span class="vars">$ntid<font color="#dd0000"></font></span>; <span></span> </li> <li class="alt"> <span></span><span class="vars">$parentid<font color="#dd0000"></font></span> =<span></span><span class="vars">$btype<font color="#dd0000"></font></span> ; <span></span> </li> <li class=""> <span></span><span class="comment">//$child = $child <font color="#008200"></font></span> <span></span> </li> <li class="alt"> <span></span><span class="keyword"><strong>if<font color="#006699"></font></strong> (</span><span>) </span>$parentstr<span class="vars"><font color="#dd0000"></font>==</span><span></span>"0"<span class="string"> <font color="#0000ff"></font>){ </span><span></span> </li> <li class=""> <span></span>$parentstr<span class="vars"><font color="#dd0000"></font>=</span><span></span>$btype<span class="vars"><font color="#dd0000"></font>; </span><span></span> }</li> <li class="alt"> <span> </span><span class="keyword">else<strong><font color="#006699"></font></strong>{ </span><span></span> </li> <li class=""> <span></span>$parentstr <span class="vars"><font color="#dd0000"></font>=</span><span></span>$parentstr<span class="vars"><font color="#dd0000"></font>.</span><span></span>","<span class="string"><font color="#0000ff"></font>.</span><span></span>$btype<span class="vars"><font color="#dd0000"></font>; </span><span></span> } </li> <li class="alt"> <span></span> </li> <li class=""> <span></span>}</li> <li class="alt"> <span></span><span class="keyword">else<strong> <font color="#006699"></font></strong>{ </span><span></span> </li> <li class=""> <span></span>$ Depth<span class="vars"><font color="#dd0000"></font>=0; </span><span></span> </li> <li class="alt"> <span></span>$rootid<span class="vars"><font color="#dd0000"></font>=</span><span> </span>$ntid<span class="vars"><font color="#dd0000"></font>; </span><span></span> </li> <li class=""> <span></span>$orders <span class="vars"><font color="#dd0000"></font>=1; </span><span></span> </li> <li class="alt"> <span></span>$parentid<span class="vars"><font color="#dd0000"></font>=0; </span><span></span> </li> <li class=""> <span></span>$child<span class="vars"><font color="#dd0000"></font>=0; </span><span></span> </li> <li class="alt"> <span></span>$parentstr<span class="vars"><font color="#dd0000"></font>=0 ; </span><span></span>}</li> <li class="alt"><span> </span></li> <li class=""> <span></span><span class="comment"><font color="#008200">//カテゴリを挿入</font></span><span></span> </li> <li class="alt"> <span>$query</span><span class="vars"><font color="#dd0000">=mysql_query(</font></span><span>" b_mtype に挿入 value('$ntid','$tn', '$parentid','$parentstr','$ Depth','$rootid','','$orders')"</span><span class="string"><font color="#0000ff">) ; </font></span><span></span> </li> <li class=""> <span>//デバッグ用 echo "insert into b_mtype value('$ntid','$tn','$parentid','$parentstr','$ Depth','$rootid','','$orders')"; </span><span class="comment"><font color="#008200"> </font></span><span></span> </li> <li class="alt"><span></span></li> <li class=""> <span></span>if<span class="keyword"><strong><font color="#006699"></font> (</strong></span><span>$btype</span><span class="vars"><font color="#dd0000">!=0) </font></span><span></span> { </li> <li class="alt"><span></span></li> <li class=""> <span></span>if <span class="keyword"><strong><font color="#006699"></font> (</strong></span><span>$深さ</span><span class="vars"> <font color="#dd0000"> &gt; 0)</font></span><span></span> </li> <li class="alt"> <span></span>$i</li> <li class=""> <span></span>)<span class="comment"><font color="#008200">(</font></span><span>$parentid</span> </li> <li class="alt">!=<span></span><span class="keyword"> ""<strong><font color="#006699"></font>){"</strong></span> <span>); </span><span class="vars"><font color="#dd0000"></font> }/</span><span></span> // 父クラスの親クラスのレイアウトを取得します<span class="vars"><font color="#dd0000"></font> </span><span></span><span class="vars"> <font color="#dd0000"></font></span> $ resurt<span></span><span class="vars"> = MySQL_QUERY (<font color="#dd0000">) </font></span> "から親IDを選択してくださいb_mtype where typeid = '$parentid'"<span></span>); </li> <li class=""> <span></span> <span class="comment"><font color="#008200"></font> </span><span></span>if</li> <li class="alt"> <span></span><span class="keyword"> <strong><font color="#006699"></font>$par</strong></span><span>[</span> <span class="vars"><font color="#dd0000">'親ID'</font></span><span>]!= </span><span class="string"><font color="#0000ff">""</font></span><span>){ </span> </li> <li class=""> <span> </span><span class="vars">$parentid<font color="#dd0000"></font></span>=<span></span><span class="string">$par<font color="#0000ff">[</font></span><span>'parentid'</span> </li> <li class="alt">];Circ // サイクル数が 1 より大きく、最後のサイクルまで実行される場合、更新は直接更新されます。 =</li> <li class="alt"> <span>$parentid</span><span class="comment"><font color="#008200">!=</font></span><span>"" </span> </li> <li class="">){ <span></span><span class="keyword"><strong> <font color="#006699"></font></strong>$query</span><span></span>=mysql_query(<span class="vars"><font color="#dd0000"></font>"update b_mtype set child=child+1 where typeid='$parentid'"</span><span></span>); <span class="vars"><font color="#dd0000"></font> </span> reautsレイアウトソーティングとレイアウトソートシーケンス番号は、このニーズよりも大きく、このカテゴリの下で、rootid = '$ rootid'およびgt; '$ order' " ); <span></span><span class="vars"><font color="#dd0000"> </font></span><span>//echo "orders1= “.$orders1; ='$ntid'"</span><span class="string"><font color="#0000ff"></font></span>) <span> }</span> </li> <li class="alt"> <span>else</span><span class="vars"><font color="#dd0000"></font>{ </span><span></span>//if($ Depth>0)に相当、上位の分類深さが0の場合は上位を更新するだけ カテゴリページ数とページを通し番号でソートするだけ <span class="string"><font color="#0000ff"></font></span><span></span> </li> <li class=""> <span></span>); </li> <li class="alt"> <span></span><span class="comment"><font color="#008200"></font>}</span> </li> <li class=""><span> </span></li> <li class="alt"> <span></span><span class="func">echo</span><span></span><span class="string"><font color="#0000ff">"< script language='javascript'>"</font></span><span></span> </li> <li class=""> <span></span><span class="func">echo</span> <span>; </span><span class="string"><font color="#0000ff">"alert('カテゴリが正常に追加されました!');"</font></span><span>; </span> </li> <li class="alt"> <span></span><span class="func">echo</span><span> </span><span class="string"><font color="#0000ff">"location.href='?';"</font></span><span></span> </li> <li class=""> <span></span>echo<span class="func">; </span> <span></span><span class="string">"< /script>"<font color="#0000ff"></font></span>; <span></span> </li> <li class="alt">} </li> <li class=""><span>?> </span></li> <li class="alt"><span> </span></li> <li class=""><span>< ?PHP </SPAN><SPAN class=comment><FONT color=#008200>////修正設定</FONT></SPAN><SPAN> </SPAN></SPAN><LI class=alt><SPAN></SPAN><SPAN class=keyword><STRONG><FONT color=#006699>function</FONT></STRONG></SPAN><SPAN> edit(){ </SPAN></SPAN><LI class=""><SPAN> </SPAN> <SPAN class=comment><FONT color=#008200>//グローバル $db,$editid,$tn, $arr; </FONT></SPAN><SPAN> </SPAN></SPAN><LI class=alt><SPAN> </SPAN><LI class=""><SPAN></SPAN><SPAN class=vars><FONT color=#dd0000>$editid</FONT></SPAN><SPAN>=</SPAN><SPAN class=vars><FONT color=#dd0000>$_REQUEST</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"editid"</FONT> </SPAN><SPAN>]; </SPAN></SPAN><LI class=alt><SPAN> </SPAN><LI class=""><SPAN></SPAN><SPAN class=vars><FONT color=#dd0000>$result</FONT></SPAN><SPAN>=mysql_query(</SPAN><SPAN class=string><FONT color=#0000ff>"select * from b_mtype where typeid='$editid'"</FONT></SPAN><SPAN>); </SPAN></SPAN><LI class=alt><SPAN></SPAN><SPAN class=vars><FONT color=#dd0000>$tn</FONT></SPAN><SPAN>=mysql_fetch_array(</SPAN><SPAN class=vars><FONT color=#dd0000>$result</FONT></SPAN><SPAN>); </SPAN></SPAN><LI class=""><SPAN>?> </span></li> <li class="alt"><span>< form name=</SPAN><SPAN class=string><FONT color=#0000ff>"form2"</FONT></SPAN><SPAN> action =</SPAN><SPAN class=string><FONT color=#0000ff>"?ToDo=saveedit"</FONT></SPAN><SPAN> method=</SPAN><SPAN class=string><FONT color=#0000ff>"post"</FONT></SPAN><SPAN>> </span></li> <li class=""> <span>< input type=</SPAN><SPAN class=string><FONT color=#0000ff>"hidden"</FONT></SPAN><SPAN> name=</SPAN><SPAN class=string><FONT color=#0000ff>"editid"</FONT></SPAN><SPAN> value=</SPAN><SPAN class=string><FONT color=#0000ff>"< ?php echo $editid;?>"</span><span>>> </span> </li> <li class="alt"><span>< table width=</SPAN><SPAN class=string><FONT color=#0000ff>"90%"</FONT></SPAN><SPAN>border=</SPAN><SPAN class=string><FONT color=#0000ff>"0"</FONT></SPAN><SPAN> align=center cellpadding=</SPAN><SPAN class=string><FONT color=#0000ff>"3"</FONT></SPAN><SPAN> cellspacing=</SPAN><SPAN class=string><FONT color=#0000ff>" 1"</FONT></SPAN><SPAN> bgcolor =</SPAN><SPAN class=string><FONT color=#0000ff>「#CCCCCC」</FONT></SPAN><SPAN>> </SPAN></SPAN><LI class=""><SPAN>< tr> </SPAN><LI class=alt><SPAN>< th height=24 colspan=2 bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#698FC7"</FONT></SPAN><SPAN> </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>クラス</FONT></STRONG></SPAN><SPAN>=</SPAN><SPAN class=string><FONT color=#0000ff>"STYLE2"</FONT></SPAN><SPAN>>编辑类别:< ?PHP </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars><FONT color=#dd0000>$tn</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"typename"</FONT></SPAN><SPAN>];?>< /th> </SPAN></SPAN><LI class=""><SPAN>< /tr> </SPAN><LI class=alt><SPAN>< tr> </SPAN><LI class=""><SPAN>< td width=</SPAN><SPAN class=string><FONT color=#0000ff>"44%"</FONT></SPAN><SPAN> height=30 bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>>类别名< /td> </SPAN></SPAN><LI class=alt><SPAN>< td width=</SPAN><SPAN class=string><FONT color=#0000ff>"56%"</FONT></SPAN><SPAN>bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>> </span></li> <li class=""> <span>< input type=</SPAN><SPAN class=string><FONT color=#0000ff>"text"</FONT></SPAN><SPAN> name=</SPAN><SPAN class=string><FONT color=#0000ff>"typename"</FONT></SPAN><SPAN> size=</SPAN><SPAN class=string><FONT color=#0000ff>"35"</FONT></SPAN><SPAN> value=</SPAN><SPAN class=string><FONT color=#0000ff>"< ?php echo $tn["</FONT> </SPAN><SPAN>タイプ名</SPAN><SPAN class=string><FONT color=#0000ff>"];?>"</span><span>> </span> </li> <li class="alt"><span>< /td> </SPAN><LI class=""><SPAN>< /tr> </SPAN><LI class=alt><SPAN> </SPAN><LI class=""><SPAN>< tr> </SPAN><LI class=alt><SPAN>< td width=</SPAN><SPAN class=string><FONT color=#0000ff>"44%"</FONT></SPAN><SPAN> height=30 bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>>< p>所属类别< /p> </SPAN></SPAN><LI class=""><SPAN> < p> <; スパン</SPAN><SPAN class=keyword><STRONG><FONT color=#006699>class</FONT></STRONG></SPAN><SPAN>=</SPAN><SPAN class=string><FONT color=#0000ff>"STYLE1"</FONT></SPAN><SPAN>>特にヒント:< /スパン>< br /> </SPAN></SPAN><LI class=alt><SPAN> 所属类别は当前类别(即自己)を父类别<に指定できません BR> </SPAN><LI class=""><SPAN> 所属类别は当前类别の子类别を父类别に指定することはできません。 /p>< /td> </SPAN><LI class=alt><SPAN>< td width=</SPAN><SPAN class=string><FONT color=#0000ff>"56%"</FONT></SPAN><SPAN>bgcolor=</SPAN><SPAN class=string><FONT color=#0000ff>"#FFFFFF"</FONT></SPAN><SPAN>> </span></li> <li class=""><span>< select name=</SPAN><SPAN class=string><FONT color=#0000ff>「クラス」</FONT></SPAN><SPAN>> </SPAN></SPAN><LI class=alt><SPAN>< オプション値=</SPAN><SPAN class=string><FONT color=#0000ff>"0"</FONT></SPAN><SPAN>>主类别< /オプション> </SPAN></SPAN><LI class=""><SPAN>< ? </SPAN><LI class=alt><SPAN></SPAN><SPAN class=vars><FONT color=#dd0000>$query</FONT></SPAN><SPAN>=mysql_query(</SPAN><SPAN class=string><FONT color=#0000ff>"select * from b_mtype order by rootid,orders"</FONT></SPAN><SPAN>); </SPAN></SPAN><LI class=""><SPAN> </SPAN><LI class=alt><SPAN></SPAN><SPAN class=keyword><STRONG><FONT color=#006699>while</FONT></STRONG></SPAN><SPAN>(</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>=mysql_fetch_array(</SPAN><SPAN class=vars><FONT color=#dd0000>$query</FONT>) </SPAN><SPAN>)) </SPAN></SPAN><LI class=""><SPAN>{ ?> </span></li> <li class="alt"> <span>< option value=</SPAN><SPAN class=string><FONT color=#0000ff>"< ?php echo $arr[typeid]?>"</span><span> < ?php </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>if</FONT></STRONG></SPAN><SPAN> (</SPAN><SPAN class=vars><FONT color=#dd0000>$tn</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"parentid"</FONT></SPAN><SPAN>] == </SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT> </SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"typeid"</FONT></SPAN> <SPAN>]) { </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string><FONT color=#0000ff>「選択済み」</FONT></SPAN><SPAN>; } ?>><< ? </SPAN><SPAN class=keyword><STRONG><FONT color=#006699>if</FONT></STRONG></SPAN><SPAN> (</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"深さ"</FONT></SPAN><SPAN>]>0) {?> </SPAN></SPAN><LI class=""><SPAN>< ?</SPAN><SPAN class=keyword><STRONG><FONT color=#006699>for</FONT></STRONG></SPAN><SPAN> (</SPAN><SPAN class=vars><FONT color=#dd0000>$i</FONT></SPAN><SPAN>=1;</SPAN><SPAN class=vars><FONT color=#dd0000>$i</FONT></SPAN><SPAN>< =</SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN> <SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>「深さ」</FONT></SPAN> <SPAN>];</SPAN><SPAN class=vars><FONT color=#dd0000>$i</FONT></SPAN><SPAN>++){ </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string><FONT color=#0000ff>"-"</FONT></SPAN><SPAN>;}?> </span> </li> <li class="alt"><span>< ? } ?>< ?php </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars><FONT color=#dd0000>$arr</FONT></SPAN><SPAN>[</SPAN><SPAN class=string><FONT color=#0000ff>"typename"</FONT></SPAN><SPAN>]?>< /オプション> </SPAN></SPAN><LI class=""><SPAN>< ? </SPAN><LI class=alt><SPAN>} </SPAN><LI class=""><SPAN>?> </span></li> <li class="alt"><span>< /選択> </span></li> <li class=""><span>< /td> </span></li> <li class="alt"><span>< /tr> </span></li> <li class=""><span> </span></li> <li class="alt"><span>< tr> </span></li> <li class=""> <span>< td幅=</span><span class="string"><font color="#0000ff">"44%"</font></span><span>高さ=2</span> </li> </ol>