sql 카운트 질문입니다. 정보
sql 카운트 질문입니다.
본문
$sql = " select bo_subject, bo_category_list from $g4[board_table] where gr_id = 'z1' order by bo_subject asc ";
$result = sql_query($sql);
이렇게 쿼리를 날리면요
실제 데이터가 5개 있습니다.
그러면 검색된게 5개인데
count()
를 어떻게 써서 5라는 결과를 보여줄수 있을까요?
$count_subject = count(sql_fetch($sql));
이렇게 하니
$count_subject 값이 5가 안나오고 2가 나오네요 --;
$result = sql_query($sql);
이렇게 쿼리를 날리면요
실제 데이터가 5개 있습니다.
그러면 검색된게 5개인데
count()
를 어떻게 써서 5라는 결과를 보여줄수 있을까요?
$count_subject = count(sql_fetch($sql));
이렇게 하니
$count_subject 값이 5가 안나오고 2가 나오네요 --;
댓글 전체
갯수만 필요하시면
$sql = " select bo_subject, bo_category_list from $g4[board_table] where gr_id = 'z1' order by bo_subject asc ";
를
$sql = " select count(*) count from $g4[board_table] where gr_id = 'z1' ";
로 바꾸세요.
$sql = " select bo_subject, bo_category_list from $g4[board_table] where gr_id = 'z1' order by bo_subject asc ";
를
$sql = " select count(*) count from $g4[board_table] where gr_id = 'z1' ";
로 바꾸세요.
mysql_num_rows()
로 해결했습니다. 감사합니다 엑스엘엠님
로 해결했습니다. 감사합니다 엑스엘엠님