아래 소스보면 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 => 새로운 데이터값 ( 어떤한 값이든 들어갈 수 있는 변수 )
위의 차이로 봐야할거 같은데요 ^^;
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 230 | 20년 전 | 2087 | ||
| 229 | 20년 전 | 3148 | ||
| 228 | 20년 전 | 3340 | ||
| 227 | 20년 전 | 2416 | ||
| 226 | 20년 전 | 5497 | ||
| 225 | 20년 전 | 2534 | ||
| 224 | 20년 전 | 2981 | ||
| 223 | 20년 전 | 4212 | ||
| 222 | 20년 전 | 2612 | ||
| 221 | 20년 전 | 2302 | ||
| 220 | 20년 전 | 3690 | ||
| 219 | 20년 전 | 2083 | ||
| 218 | 20년 전 | 3584 | ||
| 217 | 20년 전 | 2496 | ||
| 216 | 20년 전 | 2932 | ||
| 215 | 20년 전 | 2241 | ||
| 214 | 20년 전 | 3351 | ||
| 213 | 20년 전 | 2931 | ||
| 212 | 20년 전 | 3073 | ||
| 211 | 20년 전 | 2158 | ||
| 210 | 20년 전 | 1928 | ||
| 209 | 20년 전 | 2376 | ||
| 208 | 20년 전 | 2005 | ||
| 207 | 20년 전 | 1692 | ||
| 206 | 20년 전 | 1865 | ||
| 205 | 20년 전 | 3959 | ||
| 204 | 20년 전 | 1684 | ||
| 203 | 20년 전 | 2023 | ||
| 202 | 20년 전 | 2366 | ||
| 201 | 20년 전 | 1839 | ||
| 200 | 20년 전 | 2969 | ||
| 199 | 20년 전 | 2012 | ||
| 198 | 20년 전 | 2096 | ||
| 197 | 20년 전 | 3668 | ||
| 196 | 20년 전 | 3007 | ||
| 195 | 20년 전 | 2118 | ||
| 194 | 20년 전 | 10270 | ||
| 193 | 20년 전 | 2263 | ||
| 192 | 20년 전 | 1615 | ||
| 191 | 20년 전 | 2678 | ||
| 190 | 20년 전 | 2300 | ||
| 189 | 20년 전 | 1701 | ||
| 188 | 20년 전 | 1504 | ||
| 187 | 20년 전 | 1923 | ||
| 186 | 20년 전 | 1750 | ||
| 185 | 20년 전 | 1794 | ||
| 184 | 20년 전 | 2379 | ||
| 183 | 20년 전 | 1589 | ||
| 182 | 20년 전 | 1497 | ||
| 181 | 20년 전 | 1639 | ||
| 180 | 20년 전 | 2737 | ||
| 179 | 20년 전 | 1824 | ||
| 178 | 20년 전 | 1875 | ||
| 177 | 20년 전 | 2002 | ||
| 176 | 20년 전 | 1812 | ||
| 175 | 20년 전 | 1878 | ||
| 174 | 20년 전 | 1708 | ||
| 173 | 20년 전 | 2068 | ||
| 172 | 20년 전 | 1793 | ||
| 171 | 20년 전 | 2576 | ||
| 170 | 20년 전 | 2297 | ||
| 169 | 20년 전 | 2572 | ||
| 168 | 20년 전 | 1508 | ||
| 167 | 20년 전 | 1599 | ||
| 166 | 20년 전 | 2171 | ||
| 165 | 20년 전 | 1656 | ||
| 164 | 20년 전 | 3789 | ||
| 163 | 20년 전 | 2687 | ||
| 162 | 20년 전 | 2105 | ||
| 161 | 20년 전 | 2816 | ||
| 160 | 20년 전 | 1756 | ||
| 159 | 20년 전 | 1632 | ||
| 158 | 20년 전 | 2585 | ||
| 157 | 20년 전 | 1513 | ||
| 156 | 20년 전 | 1770 | ||
| 155 | 20년 전 | 3246 | ||
| 154 | 20년 전 | 1919 | ||
| 153 | 20년 전 | 1636 | ||
| 152 | 20년 전 | 4973 | ||
| 151 | 20년 전 | 4594 | ||
| 150 | 20년 전 | 3536 | ||
| 149 | 20년 전 | 3816 | ||
| 148 | 20년 전 | 7099 | ||
| 147 | 20년 전 | 3568 | ||
| 146 | 20년 전 | 2647 | ||
| 145 | 20년 전 | 2639 | ||
| 144 | 20년 전 | 7177 | ||
| 143 | 20년 전 | 4623 | ||
| 142 | 20년 전 | 1909 | ||
| 141 | 20년 전 | 3260 | ||
| 140 | 20년 전 | 1981 | ||
| 139 | 20년 전 | 1613 | ||
| 138 | 20년 전 | 2329 | ||
| 137 | 20년 전 | 1802 | ||
| 136 | 20년 전 | 1469 | ||
| 135 | 20년 전 | 1807 | ||
| 134 | 20년 전 | 2986 | ||
| 133 | 20년 전 | 2471 | ||
| 132 | 20년 전 | 1714 | ||
| 131 | 20년 전 | 1666 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기