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

배열로 입력된 값중에... 특정값만 뽑아낼수 있나요? 채택완료

밀랍 4년 전 조회 1,845

</p>

<p><table id="table2excel">

            <thead>

                <tr>

                    <th scope="col">성함</th>

                    <th scope="col">연락처</th>

                    <th scope="col">성별</th>

                    <th scope="col">이메일</th>

                    <th scope="col">생년월일</th>

                    <th scope="col">주소</th>

                    <th scope="col">특이사항</th>

                    <th scope="col">판매처</th>

                    <th scope="col">판매자</th>

                    <th scope="col">제품명</th>

                    <th scope="col">색상</th>

                    <th scope="col">사이즈</th>

                    <th scope="col">갯수</th>

                    <th scope="col">구입날짜</th>

                    <th scope="col">비고</th>

                </tr>

                </thead>

        <tbody>

        <?php

        for ($i=0; $i<count($list); $i++) {

            $addr = explode('|',$list[$i]['wr_14']);

            $ex_zip  = '('.$addr[0].')';

            $ex_addr1  = $addr[1];

            $ex_addr2  = $addr[2];

            $ex_addr3  = $addr[3];

            $ex_jibeon  = $addr[4];

            $wr3 = explode('|',$list[$i]['wr_3']);

            $ex_ymd1  = $wr3[0];

            $ex_ymd2  = $wr3[1];

            $ex_ymd3  = $wr3[2];

            $last_date = explode("||",$list[$i]['wr_17']);

            $last_name = explode("||",$list[$i]['wr_15']);

            $wr21 = explode("||", $list[$i]['wr_21']);

            $wr22 = explode("||", $list[$i]['wr_22']);

            $tags = explode('||',$list[$i]['wr_12']);

         ?>

        <tr>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $list[$i]['wr_9'] ?></td>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $list[$i]['wr_19'] ?></td>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $list[$i]['wr_2']?></td>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $list[$i]['wr_24'] ?></td>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $ex_ymd1.'년'.$ex_ymd2.'월'.$ex_ymd3; ?>일</td>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $ex_addr1.' '.$ex_addr2; ?></td>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $list[$i]['wr_10']?></td>

            <td rowspan="<?php echo count($tags); ?>"><?php echo $list[$i]['ca_name']?></td>            

        </tr>

        <?

        if($list[$i][wr_12]){

           $view1 = explode('||',$list[$i][wr_15]);

           $view2 = explode('||',$list[$i][wr_11]);

           $view3 = explode('||',$list[$i][wr_12]);

           $view4 = explode('||',$list[$i][wr_16]);

           $view5 = explode('||',$list[$i][wr_13]);

           $view6 = explode('||',$list[$i][wr_21]);

           $view7 = explode('||',$list[$i][wr_17]);

           $view8 = explode('||',$list[$i][wr_22]);

           $view9 = explode('||',$list[$i][wr_23]);

            for($k=0; $k<count($tags); $k++){

            ?>

        <tr></p>

<p>            <td><?=$view1[$k]?></td>

            <td><?=$view3[$k]?></td>

            <td><?=$view4[$k]?></td>

            <td><?=$view5[$k]?></td>

            <td><?=$view6[$k]?></td>

            <td><?=$view7[$k]?></td>

            <td><?=$view8[$k]?></td>    

         </tr>

        <? }  } } ?>

        </tbody>

        </table></p>

<p>

 

위와 같은 소스로 엑셀로 받고 있습니다.

여기서 년도별, 월별로 구분해서 엑셀로 다운받고 싶은데.. 어떻게 해야 할지 답이 안나옵니다.

 

예를들어 

$ex_ymd1 값이 2021년일때만 출력..

$ex_ymd1 값이 2021년이고 $ex_ymd2 값이 5월일때만 출력... 

 

이렇게만 리스트에 뿌려줄수 있나요?

머리 깨질거 같네요 ㅠㅠ

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

답변 3개

채택된 답변
+20 포인트
4년 전

array_search 함수를 검색해 보세요

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

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

좋은 방법은 
$list를 원하는 것만 뽑아 오는(select from ...) 것인데, 다른 방법은

        for ($i=0; $i

if( $ex_ymd1!='2021') continue;

또는

if( $ex_ymd1!='2021' || $ex_ymd2 !='05') continue;

추가 하시면 됩니다.

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

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

cuwaaang
4년 전

게시판인거아님?  sql 문 쿼리할때 where 문에다가 조건걸어서 하는게 깔끔할듯

 

wr_3에 날짜들어가있으면 년도만 검색시 left(wr_3,4) = 2021  이런식이였떤거같은데 검색해보세요

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

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

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

로그인