아래 소스보면 hidden 값으로 no 값은 $no으로 넘어가고..
old_img 값은 hidden값으로 <?=$data[img]?> 값으로 넘어가는데..
위 두가지 차이가 뭐죠??
위에 $no을 hidden값으로 넘기는게 위에 쿼리문에서 no = '$no'라는 sql문때문에 $no가 되는건가요??
old_img 값은 hidden값으로 <?=$data[img]?> 값으로 넘어가는데..
위 두가지 차이가 뭐죠??
위에 $no을 hidden값으로 넘기는게 위에 쿼리문에서 no = '$no'라는 sql문때문에 $no가 되는건가요??
$no 대신에 <?=$data[no]?>으로 바꾸면 값이 안넘어가지더라구요..
<?
include "lib.php";
$connect = dbconn();
include "lib.php";
$connect = dbconn();
$query = " select * from shop_data where no='$no'";
$result = mysql_query($query, $connect);
$data = mysql_fetch_array($result);
?>
<form action=shop_edit_post.php method=post enctype=multipart/form-data>
<input type=hidden name=no value='<?=$no?>'>
<input type=hidden name=old_name value='<?=$data[img]?>'>
<table width=500 border=1>
<tr>
<td> 상품명</td>
<td><input type=text name=name size=30 value='<?=$data[name]?>'></td>
</tr>
<tr>
<td>짧은설명</td>
<td><input type=text name=comment size=50 value='<?=$data[comment]?>'></td>
</tr>
<tr>
<td>금액</td>
<td><input type=text name=price size=10 value='<?=$data[price]?>'></td>
</tr>
<tr>
<td>설명</td>
<td><textarea rows=10 cols=50 name=memo><?=$data[memo]?></textarea></td>
</tr>
<tr>
<td>이미지</td>
<td><img src="../shop/data/<?=$data[img]?>" height=40><input type=file name=img size=30 value='<?=$data[img]?>'></td>
</tr>
<tr>
<td colspan=2><input type=submit value='수정하기'></td>
</tr>
</table>
</form>
$result = mysql_query($query, $connect);
$data = mysql_fetch_array($result);
?>
<form action=shop_edit_post.php method=post enctype=multipart/form-data>
<input type=hidden name=no value='<?=$no?>'>
<input type=hidden name=old_name value='<?=$data[img]?>'>
<table width=500 border=1>
<tr>
<td> 상품명</td>
<td><input type=text name=name size=30 value='<?=$data[name]?>'></td>
</tr>
<tr>
<td>짧은설명</td>
<td><input type=text name=comment size=50 value='<?=$data[comment]?>'></td>
</tr>
<tr>
<td>금액</td>
<td><input type=text name=price size=10 value='<?=$data[price]?>'></td>
</tr>
<tr>
<td>설명</td>
<td><textarea rows=10 cols=50 name=memo><?=$data[memo]?></textarea></td>
</tr>
<tr>
<td>이미지</td>
<td><img src="../shop/data/<?=$data[img]?>" height=40><input type=file name=img size=30 value='<?=$data[img]?>'></td>
</tr>
<tr>
<td colspan=2><input type=submit value='수정하기'></td>
</tr>
</table>
</form>
댓글 3개
13년 전
$no 는 이파일을 연결할때 가져온 값이겠구요.
$data[no]는 mysql에서 $data = mysql_fetch_array($result);이렇게 연결된 배열로 해당하는 필드값 이겠구요. no가 키값이면 어차피 값은 같아야 겠지요.
$data[no]는 mysql에서 $data = mysql_fetch_array($result);이렇게 연결된 배열로 해당하는 필드값 이겠구요. no가 키값이면 어차피 값은 같아야 겠지요.
배우는이군
13년 전
같은 파일인데 <? print_R($data); ?>
안에 들어있는 필드 값을 확인해보시면 될꺼 같은데요
$data[no] 이나 $no이나 같은값입니다.
안에 들어있는 필드 값을 확인해보시면 될꺼 같은데요
$data[no] 이나 $no이나 같은값입니다.
13년 전
$data[no] => 데이터베이스에 들어간 값 ( 어떠한 값이 아닌 이미 정해진 값을 불러들임 )
$no => 새로운 데이터값 ( 어떤한 값이든 들어갈 수 있는 변수 )
위의 차이로 봐야할거 같은데요 ^^;
$no => 새로운 데이터값 ( 어떤한 값이든 들어갈 수 있는 변수 )
위의 차이로 봐야할거 같은데요 ^^;
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 483 | ||
| 7929 | 9년 전 | 418 | ||
| 7928 | 9년 전 | 490 | ||
| 7927 | 9년 전 | 399 | ||
| 7926 | 9년 전 | 708 | ||
| 7925 | 9년 전 | 433 | ||
| 7924 | 9년 전 | 416 | ||
| 7923 | 9년 전 | 406 | ||
| 7922 | 9년 전 | 426 | ||
| 7921 | 9년 전 | 443 | ||
| 7920 | 9년 전 | 350 | ||
| 7919 | 9년 전 | 361 | ||
| 7918 | 9년 전 | 514 | ||
| 7917 | 9년 전 | 369 | ||
| 7916 | 9년 전 | 458 | ||
| 7915 | 9년 전 | 475 | ||
| 7914 | 9년 전 | 481 | ||
| 7913 | 9년 전 | 657 | ||
| 7912 | 9년 전 | 494 | ||
| 7911 | 9년 전 | 417 | ||
| 7910 | 9년 전 | 465 | ||
| 7909 | 9년 전 | 580 | ||
| 7908 | 9년 전 | 514 | ||
| 7907 | 9년 전 | 455 | ||
| 7906 | 9년 전 | 476 | ||
| 7905 | 9년 전 | 438 | ||
| 7904 | 9년 전 | 427 | ||
| 7903 | 9년 전 | 436 | ||
| 7902 | 9년 전 | 613 | ||
| 7901 |
|
9년 전 | 782 | |
| 7900 | 9년 전 | 671 | ||
| 7899 | 9년 전 | 458 | ||
| 7898 | 9년 전 | 454 | ||
| 7897 | 9년 전 | 409 | ||
| 7896 | 9년 전 | 428 | ||
| 7895 | 9년 전 | 548 | ||
| 7894 | 9년 전 | 453 | ||
| 7893 | 9년 전 | 429 | ||
| 7892 | 9년 전 | 468 | ||
| 7891 | 9년 전 | 823 | ||
| 7890 | 9년 전 | 1245 | ||
| 7889 | 9년 전 | 786 | ||
| 7888 |
limsy1987
|
9년 전 | 599 | |
| 7887 | 9년 전 | 644 | ||
| 7886 | 9년 전 | 532 | ||
| 7885 | 9년 전 | 501 | ||
| 7884 | 9년 전 | 493 | ||
| 7883 | 9년 전 | 499 | ||
| 7882 | 9년 전 | 556 | ||
| 7881 | 9년 전 | 533 | ||
| 7880 | 9년 전 | 652 | ||
| 7879 | 10년 전 | 541 | ||
| 7878 | 10년 전 | 1305 | ||
| 7877 | 10년 전 | 834 | ||
| 7876 | 10년 전 | 571 | ||
| 7875 | 10년 전 | 644 | ||
| 7874 |
|
10년 전 | 849 | |
| 7873 | 10년 전 | 569 | ||
| 7872 | 10년 전 | 734 | ||
| 7871 | 10년 전 | 549 | ||
| 7870 | 10년 전 | 669 | ||
| 7869 | 10년 전 | 485 | ||
| 7868 | 10년 전 | 528 | ||
| 7867 | 10년 전 | 532 | ||
| 7866 | 10년 전 | 588 | ||
| 7865 | 10년 전 | 533 | ||
| 7864 | 10년 전 | 587 | ||
| 7863 | 10년 전 | 585 | ||
| 7862 | 10년 전 | 555 | ||
| 7861 | 10년 전 | 727 | ||
| 7860 | 10년 전 | 701 | ||
| 7859 | 10년 전 | 471 | ||
| 7858 | 10년 전 | 778 | ||
| 7857 | 10년 전 | 1166 | ||
| 7856 | 10년 전 | 591 | ||
| 7855 | 10년 전 | 833 | ||
| 7854 | 10년 전 | 772 | ||
| 7853 | 10년 전 | 672 | ||
| 7852 | 10년 전 | 587 | ||
| 7851 | 10년 전 | 589 | ||
| 7850 | 10년 전 | 664 | ||
| 7849 | 10년 전 | 439 | ||
| 7848 | 10년 전 | 503 | ||
| 7847 | 10년 전 | 738 | ||
| 7846 | 10년 전 | 523 | ||
| 7845 | 10년 전 | 499 | ||
| 7844 | 10년 전 | 466 | ||
| 7843 | 10년 전 | 502 | ||
| 7842 | 10년 전 | 483 | ||
| 7841 | 10년 전 | 451 | ||
| 7840 | 10년 전 | 473 | ||
| 7839 | 10년 전 | 518 | ||
| 7838 | 10년 전 | 585 | ||
| 7837 | 10년 전 | 413 | ||
| 7836 | 10년 전 | 456 | ||
| 7835 | 10년 전 | 545 | ||
| 7834 |
|
10년 전 | 1244 | |
| 7833 | 10년 전 | 502 | ||
| 7832 | 10년 전 | 486 | ||
| 7831 | 10년 전 | 659 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기