:::MySQL:::::::::::::::::::::::::
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\Documents and Settings\Administrator>cd..

C:\Documents and Settings>cd..

C:\>cd \mysql -u apple -p
지정된 경로를 찾을 수 없습니다.

C:\>cd \mysql -u root -p
지정된 경로를 찾을 수 없습니다.

C:\>cd \mysql -u root -p
지정된 경로를 찾을 수 없습니다.

C:\>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.0.22-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
mysql>
mysql>
mysql>
mysql>

mysql> create database appledb;
Query OK, 1 row affected (0.09 sec)

mysql> grant all on appledb. * to apple@localhost identified by '1234';
Query OK, 0 rows affected (0.16 sec)

mysql> exit
Bye

C:\>mysql -u apple -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 4.0.22-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> c

:::메모장작업소스-수정:::::::::::::::::::::::::::
---메모장리스트--------------------------------
***memolist.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

</HEAD>

<BODY>
<table border=1 width=500>
<tr>
<td>번호</td>
<td>이름</td>
<td>이메일</td>
<td>메모</td>
<td>수정</td>

</tr>
<?
include "connect.php";
$query="select * from mymemo";
$result=mysql_query($query,$connect);
while($row=mysql_fetch_row($result)){
echo"<tr>
<td>$row[0]</td>
<td>$row[1]&nbsp;</td>
<td>$row[2]&nbsp;</td>
<td>$row[3]&nbsp;</td>
<td><a href=memodifry.html?num=$row[0]>수정</a></td>
</tr>";
}
?>
</table>
<br>
<!--<a href="memo.html">메모입력</a>-->
<a href="memoinput.html">메모입력</a>
</BODY>
</HTML>

---수정-----------------------------------
***memodifry.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

</HEAD>

<BODY>
<?
echo "넘어온 글번호 --- $num<br>";
include "connect.php";
$query="select * from mymemo where num='$num'";
$result=mysql_query($query,$connect);
$row=mysql_fetch_array($result);
?>

<br>
<form method=post action=memomodifry.php?num=<?echo $row[num];?>>
<table border=1 width=500>

<tr>
<td>이름</td>
<td><input type=text name=name value=<?echo$row[1];?>></td>
</tr>
<tr>
<td>이메일</td>
<td><input type=text name=email value=<?echo$row[2];?>></td>
</tr>
<tr>
<td>메모</td>
<td><input type=text name=memo value=<?echo$row[3];?>> <size=50></td>
</tr>

<tr>
<td colspan=2 align=center>
<input type=submit value=전송>&nbsp;&nbsp;&nbsp;
<input type=reset value=취소>
</td>
</tr>
</table>
</form>
</BODY>
</HTML>

---입력----------------------------
***memoinput.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

</HEAD>

<BODY>

<br>
<form method=post action=memoinput.php>
<table border=1 width=500>

<tr>
<td>이름</td>
<td><input type=text name=name></td>
</tr>
<tr>
<td>이메일</td>
<td><input type=text name=email></td>
</tr>
<tr>
<td>메모</td>
<td><input type=text name=memo size=50></td>
</tr>

<tr>
<td colspan=2 align=center>
<input type=submit value=전송>&nbsp;&nbsp;&nbsp;
<input type=reset value=취소>
</td>
</tr>
</table>
</form>
</BODY>
</HTML>


---DB연결--------------------------
***connect.php
<?
$connect=mysql_connect("localhost","apple","1234");
$db=mysql_select_db("appledb",$connect);
?>
::::::::::::::::::::::::::::::::::::::::::::



PHP 스터디 2004 11 26

자세히보기: http://www.6VJ.com/php/php1126.txt
http://www.6VJ.com/php/php1126.html