단어장프로젝트
<html> <head> <title> 프로젝트2 단어장 </title> <body> <style> select * from address where address like '% 경기도 %' td,li,input{font-size:9pt} </style> <table border=0 width=80%> <tr> <form action= search.html > <td align=center><font <li> 주소검색 : <input size=+2 type=text color=bluesky> name=add> < 프로젝트 <input 2 단어장 type=submit ></font></table> value=" 검색 "> <table border=1 width=80% cellpadding=5 cellspacing=1 bgcolor=#000000> <td> 최근순 <td> <a href='word_list.html?order=date'>[ 전체목록 ]</a> <? for($i=0,$a=a;$i<26;$i++,$a++){ echo "<td width=3%><a href='?order=date&alphabet=$a'>$a </a>"; }?> <td> 알파벳순 <td> <a href='word_list.html?order=voca'>[ 전체목록 ]</a>
<? for($i=0,$a=a;$i<26;$i++,$a++){ echo "<td><a href='?order=voca&alphabet=$a'>$a </a>"; } select * from address where address like '% 경기도 %'?> <form action= search.html > <td colspan=28> <form <li> action=<?="$php_self"?> 주소검색 : <input type=text method=post> name=add> <input <input type=text type=submit name=search value=" size=20> 검색 "> <input type=submit name=search_id value=" 단어검색 ( 최근순 )"> <input type=submit name=search_id value=" 단어검색 ( 알파벳순 )"> </table> <br> <form action="word_list.html" method=post> <table border=1 width=80% cellpadding=5 cellspacing=1 bgcolor=#000000> <td> 단어 : <input type=text name=voca size=20>
<td> 품사 : <select name=cla> <option value=" 명사 "> 명사 <option value=" 대명사 "> 대명사 <option value=" 동사 "> 동사 <option value=" 형용사 "> 형용사 <option value=" 부사 "> 부사 select * from address where address like '% 경기도 %' <option value=" 전치사 "> 전치사 <form <option action= search.html > value=" 접속사 "> 접속사 <li> <option 주소검색 value=" : <input 감탄사 "> type=text 감탄사 name=add> <input </select> type=submit value=" 검색 "> <td> 뜻 : <input type=text name=mean size=20> <td> 동의어 : <input type=text name=agree size=20> <td colspan=3> 반의어 : <input type=text name=reverse size=20> <td> 예문 : <td colspan=4><input type=text name=ex size=110> <td width=10%> <input type=submit value=" 단어등록 "> </table> <br> <br>
<table border=1 width=80% cellpadding=5 cellspacing=1 bgcolor=#000000> <td colspan=8> <font size=+1 color="bluesky"> 단어목록 </font> <tr select bgcolor=#ffffff * from address align=center> where address like '% 경기도 %' <td> 단어 <td> 품사 <td> 뜻 <td> 동의어 <td> 반의어 <td width=10%> 삭제 <? $connect = mysql_connect("localhost","mysqlid","mysqlpw") or die(" 접속불가 "); mysql_select_db("learntorial"); <form action= search.html > if(!$agree){$agree=".";} <li> 주소검색 : <input type=text name=add> if(!$reverse){$reverse=".";} <input type=submit value=" 검색 "> if($voca and $cla and $mean and $agree and $reverse and $ex){ $query2 = "insert into word(voca, cla, mean, agree, reverse, ex, date) values('$voca','$cla','$mean','$agree','$reverse','$ex',now())"; mysql_query($query2, $connect); } $query = "select * from word "; if($search){$query.="where voca like '%$search%'";} if($alphabet){$query.="where voca like '$alphabet%'";} $result = mysql_query($query, $connect); $data=mysql_fetch_array($result);
if(!$data[voca]){ echo " <td colspan=8> 검색된단어가없습니다."; }else{ mysql_close($connect); select * from address where address like '% 경기도 %' <form action= search.html > <li> 주소검색 : <input type=text name=add> <input type=submit value=" 검색 "> $connect = mysql_connect("localhost","mysqlid","mysqlpw"); mysql_select_db("learntorial"); if($search_id==" 단어검색 ( 최근순 )"){$order=date;} if($search_id==" 단어검색 ( 알파벳순 )"){$order=voca;} $query = "select * from word "; if($search){$query.="where voca like '%$search%'";} if($alphabet){$query.="where voca like '$alphabet%'";} if($order=="date"){$query.="order by date desc";} if($order=="voca"){$query.="order by voca asc";} if(!$order){$query.="order by voca asc";} $result = mysql_query($query, $connect); while($data = mysql_fetch_array($result)){
?> <td bgcolor=yellow> <b><?=$data[voca]?></b> <td> select <?=$data[cla]?> * from address where address like '% 경기도 %' <td> <?=$data[mean]?> <td> <?=$data[agree]?> <td> <?=$data[reverse]?> <td> <form <a action= search.html > href="word_del.html?no=<?=$data[no]?>"> 단어삭제 </a> <tr bgcolor=#ffffff <li> 주소검색 align=center> : <input type=text name=add> <td> <input 예문 <td type=submit colspan=7> value=" <?=$data[ex]?> 검색 "> <? } } mysql_close($connect);?> </table> </body> </html>
요점정리 알파벳순검색 for($i=0,$a=a;$i<26;$i++,$a++){ echo "<td width=3%><a href='?order=date&alphabet=$a'>$a </a>"; } Search 부분 <input type=submit name=search_id value=" 단어검색 ( 최근순 )"> <input type=submit name=search_id value=" 단어검색 ( 알파벳순 )"> 입력 if($voca and $cla and $mean and $agree and $reverse and $ex){ 데이터선택 if($search){$query.= " where voca like '%$search%'"; if($order== date"){$query.= " order by date desc";}
요점정리 사용자선택기능사용되는변수 $query 에추가되는옵션 전체목록 최근순 $order Order by date desc 단어순 $order Order by voca asc 검 색 최근순 단어순 $search, $search_id $search, $search_id where like '%$search%' order by date desc where like '$alphabet%' order by voca asc 알파벳 최근순 단어순 $alphabet, $order $alphabet, $order where like '%$search%' order by date desc where like '$alphabet%' order by voca asc