하나만 알려주세요
본문
상품등록 엑셀업데이트하면서
it_img7 = '$it_img7',
it_img8 = '$it_img8',
it_img9 = '$it_img9',
it_img10 = '$it_img10' ";
sql_query($sql);
$String = $it['picture'];
//문자열 자르기 : 배열로 저장된다.
$strpic =explode('|' , $String);
//배열 크기 가져오기
$cnt = count($strpic);
for($i = 0 ; $i < $cnt ; $i++){
$var="jpg";
$pos=stripos($strpic[$i],$var);
$strpic[$i]=substr($strpic[$i], 0 ,$pos+strlen($var));
$it_img1 = $strpic[0];
sql_query(" update {$g5['g5_shop_item_table']} set it_img1 = '$it_img1' where it_id = '$it_id' ");
}
$succ_count++;
$picture가 배열로 들어가 있어 배열을 분리하고
jpg 뒷부분 날리고
분리된 배열의
첫번째
$strpic[0] 이걸 it_img1에 집어넣으려는데 어느부분이 안되는걸까요?
이게 출력할때는 잘되거든요
<?php //문자열 자르기 (explode)
$String = "{$it['picture']}";
//문자열 자르기 : 배열로 저장된다.
$strpic =explode('|' , $String);
//배열 크기 가져오기
$cnt = count($strpic);
for($i = 0 ; $i < $cnt ; $i++){
$var="jpg";
$pos=stripos($strpic[$i],$var);
$strpic[$i]=substr($strpic[$i],0,$pos+strlen($var));
echo($strpic[$i]"'<br/>");
}
?>
!-->
답변 1
$String = $it['picture'];
$strpic = explode('|' , $String);
$it_img1 = str_replace('.jpg', '', $strpic[0]);
sql_query(" update {$g5['g5_shop_item_table']} set it_img1 = '$it_img1' where it_id = '$it_id' ");
답변을 작성하시기 전에 로그인 해주세요.