해도해도 안되서..질문드려요...배열갯수 제한 이요!
본문
아래와 같은 php 배열이 있습니다. while을 이용해서 배열중인 소스인데. 아래 소스의 배열개수를 딱 20개까지만
출력하고 20개가 넘으면 출력을 안하게하려면 어찌해야하나요....?
$i <6; $db1_count < 6 .. 다해봣는데... 입력 위치떄문인지..안되네요.....왜그런가요 ?ㅠㅠ
[code]
if($db1_count > 0 )
{
$i=1;
$chop_no=20;
while($bbsdata=mysql_fetch_object($db1))
{
$img_type = &$bbsdata->file_type;
$img_name = "../wi_files/item_thum/".$bbsdata->bbs_no.".".$img_name_array[$img_type];
if($bbsdata->file_name !='')
{
$img_name = "../wi_files/item_any/".$bbsdata->file_name;
}
?>
<li class='itemlist_li' ></li>
<?
$i++; } } else {?>
{
?>
<li style="width: 880px; heifhr: 500px;" class="glo_li txt_ac">
</li>
<?php
}
?>
</ul>
[/code]
답변 3
if($i == $chop_no) break;
$i++;
$str="where join_check='2' and big_no='1' and item_icon1='1'";
$str_sort="order by bbs_sort_no desc";
$str_field="*";
$db1=$start_query->rowQuery($bbsname_item, $str, $str_sort, $str_field);
$db1_count=mysql_num_rows($db1);
상단에 위와 같은 변수선어이있습니다!
그누보드코드가 아니라 맞을지 모르겠지만 짐작으로는 아래처럼 해보세요
$str_sort="order by bbs_sort_no desc"; --> $str_sort="order by bbs_sort_no desc limit 0,20";
답변을 작성하시기 전에 로그인 해주세요.