mysql_fetch_array 질문.
그누보의 g4_popular 테이블에서 중복값을 카운트 해서 그 카운트 값을 php로 뿌려주려고 합니다.
그런데
다음과 같은 소스로 돌리면 값은 나오긴 나오는데 반복이 되서 나오네요. sql구문이 문제가 있는건지 잘 모르겠습니다.
$color = "select pp_word, count(*) as color_total from g4_popular group by pp_word order by color_total desc"; //데이터 정렬하여 카운트
$color_result = mysql_query($color);
while($cnt = mysql_fetch_array($color_result))
{
echo "$cnt[1]";
}
많은 조언 부탁드립니다.^^
그런데
다음과 같은 소스로 돌리면 값은 나오긴 나오는데 반복이 되서 나오네요. sql구문이 문제가 있는건지 잘 모르겠습니다.
$color = "select pp_word, count(*) as color_total from g4_popular group by pp_word order by color_total desc"; //데이터 정렬하여 카운트
$color_result = mysql_query($color);
while($cnt = mysql_fetch_array($color_result))
{
echo "$cnt[1]";
}
많은 조언 부탁드립니다.^^
|
댓글을 작성하시려면 로그인이 필요합니다.
댓글 2개
$color_result = mysql_query($color);
while($cnt = mysql_fetch_array($color_result))
{
echo "$cnt[1]";
}
count 를 쓰신 목적이 있으신지???
말씀하신 코드는 쓰는 곳이 없네요.
지금 태그클라우드를 하나 만들려고 하는데요.
중복된 글을 카운트해서 글자색이나, 글자크기를 변경하려고 합니다.^^
윗 코드는 제가 임의로 테스트용으로 작성한 것이구요~^^