게시판 리스트에서 확장필드 출력방법문의
본문
wr_4 필드를 아래와 같은 형태로 쪼개서 데이터를 입력받았습니다.
게시판 리스트에서 일부(ext4_01,ext4_02)를 불러와서 출력시키고싶은데 어떻게 해야하나요?
<?
$ex4_filed = explode("|",$list[$i]['wr_4']);
$ext4_00 = $ex4_filed[0];
$ext4_01 = $ex4_filed[1];
$ext4_02 = $ex4_filed[2];
$ext4_03 = $ex4_filed[3];
$ext4_04 = $ex4_filed[4];
?>
답변 3
"클립"님이 위에 제시한 소스를 for 문 안에 넣으셨나요?
해당 소스가 아래처럼 for 문에 있다면 "세모네모"님의 코드가 출력되어야 하는게 정상입니다.
wr_4 필드에 (값a|값b|값c|값d|값e) 이런 내용의 값이 있다고 가정할 때
<?php
for ($i=0; $i<count($list); $i++) {
$ex4_filed = explode("|",$list[$i]['wr_4']);
$ext4_00 = $ex4_filed[0];
$ext4_01 = $ex4_filed[1];
$ext4_02 = $ex4_filed[2];
$ext4_03 = $ex4_filed[3];
$ext4_04 = $ex4_filed[4];
echo $ext4_01; // 값b 출력
echo $ext4_02; // 값c 출력
~ 이하 생략 ~
<?php echo $ext4_01; ?>
<?php echo $ext4_02; ?>
안되는데요 ^^;
답변을 작성하시기 전에 로그인 해주세요.