get함수 조건문 질문입니다. 채택완료
하나의 소스 페이지에서 조건문을 이용하여
$_GET['type']=='1'때와 '2'일때
화면을 출력하고 싶습니다.
$currentLimit = ($onePage * $page) - $onePage; //몇 번째의 글부터 가져오는지
$sqlLimit = ' limit ' . $currentLimit . ', ' . $onePage; //limit sql 구문
$sql = "select count(*) as cnt from g5_write_sub03_01";
$sql = "select * from g5_write_sub03_01 order by wr_id desc" . $sqlLimit;
현재 쿼리문은 이런상태인데
조건쿼리문을 어떻게 더 추가해주어야할까요?
아 조건을 걸어줄 컬럼명은 wr_6입니다.
답변 2개
</p><p style="margin-left: 40px;">if($_GET[type] == "1"){</p><p style="margin-left: 40px;">$sql = "select count(*) as cnt from g5_write_sub03_01"; </p><p style="margin-left: 40px;">$sql = "select * from g5_write_sub03_01 order by wr_id desc" . $sqlLimit; </p><p style="margin-left: 40px;"> </p><p style="margin-left: 40px;">}else{</p><p style="margin-left: 40px;">$sql = "select count(*) as cnt from g5_write_sub03_01"; </p><p style="margin-left: 40px;">$sql = "select * from g5_write_sub03_01 order by wr_id desc" . $sqlLimit; </p><p style="margin-left: 40px;">}</p><p style="margin-left: 40px;">
이런걸 원하시는건지? ㅋ
댓글을 작성하려면 로그인이 필요합니다.
</strong></font></p><p><font face="Courier New">$sql</font> <code class="php plain">= </code><code class="php string">"select count(*) as cnt from g5_write_sub03_01 where wr_6='".$_GET<code class="php plain">[type].'"</code></code><code class="php plain">; </code></p><p><code class="php plain"><strong>
이런 조건을 말하는 건가요?
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인