sql 내용이 중복일때 질문입니다. 채택완료
museplay
6년 전
조회 1,886
</p>
<p><?php</p>
<p>$str = strlen($category_level);</p>
<p>if($str == 2){
$sql = "select *
from g5_shop_category
where ca_id
like '{$category_level}%'
and length(ca_id) = 4
order by ca_id asc";
$str = 4;
} else if($str == 4){
$sql = "select *
from g5_shop_category
where ca_id
like '{$category_level}%'
and length(ca_id) = 6";
}</p>
<p>?></p>
<p>
이렇게 중복인 내용이 있을때 간결하게 표현하고 싶은데 방법이 있을까요...?
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
답변을 작성하려면 로그인이 필요합니다.
로그인