"> ">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Base Web Programming

Similar presentations


Presentation on theme: "Data Base Web Programming"— Presentation transcript:

1 Data Base Web Programming
PHP

2 “addr_list2.html” 작성 <?
$dbconn = mysql_connect("localhost",“hk ","a12345"); $status = mysql_select_db(“hk "); // DB명 = ID와 같음 if (!$status) { echo("DB_ERROR"); exit; } // 주소읽기 if ($na) $sqry1 = " select * from addr where na like '%$na%' "; else $sqry1 = " select * from addr "; $result = mysql_query($sqry1); $rows = mysql_num_rows($result); ?>

3 한 줄로 입력 <HTML> <HEAD> <TITLE>주소등록</TITLE>
<BODY> <table border=1> <tr> <td>순번</td> <td>이름</td> <td>핸드폰</td> <td>이메일</td> </tr> <? for($i = 1; $i <= $rows; $i++) { $row = mysql_fetch_object($result); ?> <td><a href='./addr_view.html?seq=<?echo($row->seq)?>'> <?echo($row->seq)?></a></td> <td><?echo($row->na)?></td> <td><?echo($row->hp)?></td> <td><?echo($row-> )?></td> } 한 줄로 입력

4 </table> <Form method="post" action="addr_list2.html"> 이름 : <input type="text" name="na" size="10"> <input type="submit" value="전송"> </form> <br> <a href="./addr.html">주소 입력</a> </BODY> </HTML>

5

6 “addr_view.html” 수정 <? // ID PWD
$dbconn = mysql_connect("localhost",“hk ","a12345"); $status = mysql_select_db(“hk "); // DB명 = ID와 같음 if (!$status) { echo("DB_ERROR"); exit; } // 주소읽기 $sqry1 = " select * from addr where seq=$seq "; $result = mysql_query($sqry1); $row = mysql_fetch_object($result); ?>

7 <TITLE>주소상세보기</TITLE>
</HEAD> <BODY> <table border=1> <tr> <td>순번</td> <td><?echo($row->seq)?></td> </tr> <td>이름</td> <td><?echo($row->na)?></td> <td>핸드폰</td> <td><?echo($row->hp)?></td> <td>이메일</td> <td><?echo($row-> )?></td> <td>주소</td> <td><?echo($row->addr)?></td> </table> <a href="./addr.html">주소 입력</a><br> <a href="./addr_rewrite.html?seq=<?echo($row->seq)?>">주소 수정</a><br> <a href="./addr_del.php?seq=<?echo($row->seq)?>">주소 삭제</a><br> <a href="./addr_list.html">주소 리스트</a> </BODY> </HTML>

8 “addr_del.php”신규작성 <? // ID PWD
$dbconn = mysql_connect("localhost",“hk ","a12345"); $status = mysql_select_db(“hk "); // DB명 = ID와 같음 if (!$status) { echo("DB_ERROR"); exit; } $sqry = " delete from addr where seq=$seq "; $result=mysql_query($sqry); if (!$result) echo("update ERROR"); echo("삭제 성공   "); echo("<a href='./addr_list2.html'>목록보기</a>"); ?>

9 Web에서 확인 리스트 페이지를 open한다 특정 사람을 클릭하여 View한다 주소삭제를 클릭한다
삭제유무(에러)를 확인한 다음 목록보기 클릭 삭제가 되었는지 확인한다.

10

11


Download ppt "Data Base Web Programming"

Similar presentations


Ads by Google