테스트 사이트 - 개발 중인 베타 버전입니다

상품 이미지 필드를 추가하려고 하는데요 채택완료

귀화 11년 전 조회 6,444
it_img1부터 it_img10까지 되어있는데 it_img11를 추가해서 적용해보니 오류나네요 ㅠㅠ

어떻게하면 이미지 필드를 추가할수 있을까요?

도움 부탁드립니다.

댓글을 작성하려면 로그인이 필요합니다.

답변 4개

채택된 답변
+20 포인트
편리
11년 전
어떤 오류가 발생하는지 알려주셔야 정확한 답변이 가능합니다.

추가적으로 필드를 추가하실 때는 코드 상에서 추가된 필드에 대한 코드를 추가해주셔야 하고
다음으로 phpmyadmin 등을 이용해 해당 테이블에 필드를 추가해주셔야만 합니다.
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

11년 전
와우~! 이미지 출력잘되네요..

바쁘신 업무에도 불구하고 답변주심에 다시 한번 감사를 드립니다.

좋은하루 보내세요.
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

11년 전
넵 감사합니다. it_img12 필드를 추가 생성했습니다. 오류사라졌지만 이미지 출력 안되네요..

다운로드66.png
 


로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

편리
11년 전
이미지 업로드가 제대로 되지 않은 경우인 것 같습니다. itemformupdate.php 파일에서 이미지
업로드 처리 부분을 수정해보시기 바랍니다.

댓글을 작성하려면 로그인이 필요합니다.

11년 전
adm/shop_admin

</strong></div>
<div><font face="돋움, dotum, helvetica"><b><div style="font-size: 12px; line-height: 21.600000381469727px"><b>
<div style="display: inline !important"><section id="anc_sitfrm_img"></div></b></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">    <h2 class="h2_frm">이미지</h2></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">    <?php echo $pg_anchor; ?></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">
</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">    <div class="tbl_frm01 tbl_wrap"></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        <table></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        <caption>이미지 업로드</caption></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        <colgroup></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">            <col class="grid_4"></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">            <col></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        </colgroup></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        <tbody></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        <?php for($i=1; $i<=12; $i++) { ?></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        <tr></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">            <th scope="row"><label for="it_img1">이미지 <?php echo $i; ?></label></th></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">            <td></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <input type="file" name="it_img<?php echo $i; ?>" id="it_img<?php echo $i; ?>"></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <?php</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                $it_img = G5_DATA_PATH.'/item/'.$it['it_img'.$i];</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                if(is_file($it_img) && $it['it_img'.$i]) {</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                    $size = @getimagesize($it_img);</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                    $thumb = get_it_thumbnail($it['it_img'.$i], 25, 25);</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                ?></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <label for="it_img<?php echo $i; ?>_del"><span class="sound_only">이미지 <?php echo $i; ?> </span>파일삭제</label></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <input type="checkbox" name="it_img<?php echo $i; ?>_del" id="it_img<?php echo $i; ?>_del" value="1"></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <span class="sit_wimg_limg<?php echo $i; ?>"><?php echo $thumb; ?></span></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <div id="limg<?php echo $i; ?>" class="banner_or_img"></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                    <img src="<?php echo G5_DATA_URL; ?>/item/<?php echo $it['it_img'.$i]; ?>" alt="" width="<?php echo $size[0]; ?>" height="<?php echo $size[1]; ?>"></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                    <button type="button" class="sit_wimg_close">닫기</button></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                </div></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <script></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                $('<button type="button" id="it_limg<?php echo $i; ?>_view" class="btn_frmline sit_wimg_view">이미지<?php echo $i; ?> 확인</button>').appendTo('.sit_wimg_limg<?php echo $i; ?>');</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                </script></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">                <?php } ?></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">            </td></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        </tr></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        <?php } ?></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        </tbody></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">        </table></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">    </div></div>
<div style="font-size: 12px; line-height: 21.600000381469727px"></section></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">
</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">></div>
<div style="font-size: 12px; line-height: 21.600000381469727px"><strong>

lib/shop.lib.php

</div>
<div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">// 상품 이미지를 얻는다</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img_alt='')</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">{</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    global $g5;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    if(!$it_id || !$width)</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        return '';</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    $sql = " select it_id, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10, it_img11, it_img12</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px"><span class="Apple-tab-span" style="white-space: pre">	</span> from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    $row = sql_fetch($sql);</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    if(!$row['it_id'])</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        return '';</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    for($i=1;$i<=12; $i++) {</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        $file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        if(is_file($file) && $row['it_img'.$i]) {</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            $size = @getimagesize($file);</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            if($size[2] < 1 || $size[2] > 3)</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">                continue;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            $filename = basename($file);</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            $filepath = dirname($file);</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            $img_width = $size[0];</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            $img_height = $size[1];</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            break;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        }</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    }</span></div></div>
<div style="font-size: 12px; line-height: 21.600000381469727px">
</div>
<div style="font-size: 12px; line-height: 21.600000381469727px">
</div>
<div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">// 이미지 URL 을 얻는다.</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">function get_it_imageurl($it_id)</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">{</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    global $g5;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    $sql = " select it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10, it_img11, it_img12</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">                from {$g5['g5_shop_item_table']}</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">                where it_id = '$it_id' ";</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    $row = sql_fetch($sql);</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    $filepath = '';</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    for($i=1; $i<=12; $i++) {</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        $img = $row['it_img'.$i];</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        $file = G5_DATA_PATH.'/item/'.$img;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        if(!is_file($file))</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            continue;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        $size = @getimagesize($file);</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        if($size[2] < 1 || $size[2] > 3)</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">            continue;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        $filepath = $file;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    }</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    if($filepath)</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        $str = str_replace(G5_PATH, G5_URL, $filepath);</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    else</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">        $str = G5_SHOP_URL.'/img/no_image.gif';</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">
</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">    return $str;</span></div>
<div><span style="font-size: 12px; line-height: 21.600000381469727px">}</span></div></div>
<div>
</div>
<div><strong style="font-size: 12px; line-height: 21.600000381469727px">

moblie/shop/largeimage.php

</div>
<div>
</div>
<div>
<div>$sql = " select it_id, it_name, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10, it_img11, it_img12</div>
<div>            from {$g5['g5_shop_item_table']} where it_id='$it_id' ";</div>
<div>$row = sql_fetch_array(sql_query($sql));</div>
<div>
</div>
<div>if(!$row['it_id'])</div>
<div>    alert_close('상품정보가 존재하지 않습니다.');</div>
<div>
</div>
<div>$imagefile = G5_DATA_PATH.'/item/'.$row['it_img'.$no];</div>
<div>$imagefileurl = G5_DATA_URL.'/item/'.$row['it_img'.$no];</div>
<div>$size = getimagesize($imagefile);</div>
<div>
</div>
<div>$g5['title'] = "{$row['it_name']} ($it_id)";</div>
<div>include_once(G5_PATH.'/head.sub.php');</div>
<div>?></div>
<div>
</div>
<div><div id="sit_pvi_nw" class="new_win"></div>
<div>    <h1 id="win_title">상품 이미지 새 창 보기</h1></div>
<div>
</div>
<div>    <div id="sit_pvi_nwbig"></div>
<div>        <?php</div>
<div>        $thumbnails = array();</div>
<div>        for($i=1; $i<=12; $i++) {</div>
<div>            if(!$row['it_img'.$i])</div>
<div>                continue;</div>
<div>
</div>
<div>            $file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];</div>
<div>            if(is_file($file)) {</div>
<div>                // 썸네일</div>
<div>                $thumb = get_it_thumbnail($row['it_img'.$i], 60, 60);</div>
<div>                $thumbnails[$i] = $thumb;</div>
<div>                $imageurl = G5_DATA_URL.'/item/'.$row['it_img'.$i];</div>
<div>        ?></div>
<div>        <span></div>
<div>            <a href="javascript:window.close();"></div>
<div>                <img src="<?php echo $imageurl; ?>" width="<?php echo $size[0]; ?>" height="<?php echo $size[1]; ?>" alt="<?php echo $row['it_name']; ?>" id="largeimage"></div>
<div>            </a></div>
<div>        </span></div>
<div>        <?php</div>
<div>            }</div>
<div>        }</div>
<div>        ?></div>
<div>    </div></div></div>
<div>
</div>
<div>

이렇게 적용햇는데요

select it_id, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10, it_img11, it_img12 from g5_shop_item where it_id = '1392285222'

1054 : Unknown column 'it_img12' in 'field list'

error file : /k3/shop/item.php

라고 오류뜹니다.




로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

편리
11년 전
it_img12 필드가 g5_shop_item 테이블에 존재하지 않는 오류입니다.
phpmyadmin 등을 이용해 item 테이블에 it_img12 필드를 추가 생성해 주셔야 합니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인