제가 이벤트 페이지를 만드는데 처음에는 아이디하나만 나오게하는게 막혀서 찾아보니 group by로하면
한아이디만 나온다는걸 알게됐는데
두번째 문제가 응모횟수를 뽑는건 어떻게 해야하는거죠?
그냥 cnt하면 전체 응모횟수가 나오고
위에서 user_id=$user_id해봤자 user_id를 못받으니 소용없는거구..
어떻하면 응모횟수를 뽑을수있을가요?
고수님들 도와주세요
<table border="0" cellspacing="1" cellpadding="0" width="1300" bgcolor="#383838">
<tr height="30">
<td align="center" style="width:35px; background:#EFEFEF;">번호</td>
<td align="center" style="width:80px; background:#EFEFEF;">아이디</td>
<td align="center"style="width:55px; background:#EFEFEF;">이름</td>
<td align="center" style="width:90px; background:#EFEFEF;">연락처</td>
<td align="center" style="width:80px; background:#EFEFEF;">응모횟수</td>
<td align="center" style="width:40px; background:#EFEFEF;">삭제</td>
</tr>
<?
$Qry = "SELECT count(*) as cnt FROM 응모테이블 teb JOIN 회원테이블 tc ON teb.user_id = tc.id WHERE teb.del_flag = 'N' AND teb.user_id !=''";
$DB->query($Qry);
$DB->next_record();
$total_count = $DB->FieldByName["CNT"];
$DB->free_result();
$total_page_cnt = (ceil($total_count / $page_size) <= 0) ? 1 : ceil($total_count / $page_size);
if ($page > $total_page_cnt) {
$page = $total_page_cnt;
}
$Qry = "
SELECT
teb.seq AS seq, teb.user_id AS user_id,
teb.subject AS subject ,
teb.contents AS contents ,
tc.name AS name, tc.resident AS resident,
tc.addr2 AS addr2, tc.phone AS phone,
tc.hphone AS hphone
FROM
응모테이블 teb JOIN 회원테이블 tc
ON
teb.user_id = tc.id
WHERE
teb.delYN = 'N' AND teb.event_seq = 66 AND teb.user_id!=''
group by teb.user_id
order by teb.seq desc";
$DB->query($Qry);
$i = 0;
while ($DB->next_record()) {
$desccnt = $total_count - $i - ($page_size * ($page -1));
?>
<tr height=30>
<td align="center" bgcolor="#FFFFFF"></td>
<td align="center" bgcolor="#FFFFFF"></td>
<td align="center" bgcolor="#FFFFFF"></td>
<td align="center" bgcolor="#FFFFFF"></td>
<td align="center" bgcolor="#FFFFFF">???????번 </td>
<td align="center" bgcolor="#FFFFFF">삭제</td>
</tr>
<?$i++;}?>
</table>
댓글 1개
배우는이군
13년 전
$Qry = "SELECT a.user_id, count(b.id) as cnt, b.id FROM member as a left join board as b on a.user_id = b.id WHERE a.del_flag = 'N' 이러케 하면 나올꺼 같은데요....
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 65 | ||
| 8229 | 9년 전 | 66 | ||
| 8228 |
커네드커네드
|
9년 전 | 110 | |
| 8227 | 9년 전 | 120 | ||
| 8226 | 9년 전 | 158 | ||
| 8225 | 9년 전 | 146 | ||
| 8224 | 9년 전 | 143 | ||
| 8223 | 9년 전 | 111 | ||
| 8222 |
|
9년 전 | 179 | |
| 8221 | 9년 전 | 83 | ||
| 8220 | 9년 전 | 97 | ||
| 8219 | 9년 전 | 96 | ||
| 8218 | 9년 전 | 133 | ||
| 8217 |
star3840
|
9년 전 | 108 | |
| 8216 | 9년 전 | 158 | ||
| 8215 | 9년 전 | 105 | ||
| 8214 | 9년 전 | 221 | ||
| 8213 | 9년 전 | 154 | ||
| 8212 | 9년 전 | 81 | ||
| 8211 | 9년 전 | 241 | ||
| 8210 | 9년 전 | 239 | ||
| 8209 | 9년 전 | 331 | ||
| 8208 | 9년 전 | 212 | ||
| 8207 | 9년 전 | 220 | ||
| 8206 |
|
9년 전 | 182 | |
| 8205 | 9년 전 | 166 | ||
| 8204 | 9년 전 | 128 | ||
| 8203 | 9년 전 | 228 | ||
| 8202 | 9년 전 | 137 | ||
| 8201 | 9년 전 | 176 | ||
| 8200 | 9년 전 | 156 | ||
| 8199 | 9년 전 | 206 | ||
| 8198 | 9년 전 | 168 | ||
| 8197 | 9년 전 | 158 | ||
| 8196 | 9년 전 | 547 | ||
| 8195 | 9년 전 | 154 | ||
| 8194 | 9년 전 | 278 | ||
| 8193 | 9년 전 | 153 | ||
| 8192 | 9년 전 | 181 | ||
| 8191 | 9년 전 | 133 | ||
| 8190 | 9년 전 | 126 | ||
| 8189 | 9년 전 | 185 | ||
| 8188 | 9년 전 | 125 | ||
| 8187 | 9년 전 | 138 | ||
| 8186 | 9년 전 | 138 | ||
| 8185 | 9년 전 | 304 | ||
| 8184 | 9년 전 | 105 | ||
| 8183 | 9년 전 | 320 | ||
| 8182 | 9년 전 | 163 | ||
| 8181 | 9년 전 | 125 | ||
| 8180 | 9년 전 | 690 | ||
| 8179 | 9년 전 | 480 | ||
| 8178 | 9년 전 | 306 | ||
| 8177 |
kiplayer
|
9년 전 | 309 | |
| 8176 | 9년 전 | 346 | ||
| 8175 | 9년 전 | 217 | ||
| 8174 | 9년 전 | 235 | ||
| 8173 | 9년 전 | 341 | ||
| 8172 | 9년 전 | 192 | ||
| 8171 | 9년 전 | 179 | ||
| 8170 | 9년 전 | 293 | ||
| 8169 |
커네드커네드
|
9년 전 | 253 | |
| 8168 | 9년 전 | 314 | ||
| 8167 | 9년 전 | 315 | ||
| 8166 | 9년 전 | 231 | ||
| 8165 | 9년 전 | 161 | ||
| 8164 | 9년 전 | 299 | ||
| 8163 | 9년 전 | 279 | ||
| 8162 | 9년 전 | 293 | ||
| 8161 | 9년 전 | 291 | ||
| 8160 |
|
9년 전 | 483 | |
| 8159 | 9년 전 | 423 | ||
| 8158 | 9년 전 | 242 | ||
| 8157 | 9년 전 | 370 | ||
| 8156 | 9년 전 | 273 | ||
| 8155 | 9년 전 | 249 | ||
| 8154 |
00년생용띠
|
9년 전 | 596 | |
| 8153 | 9년 전 | 224 | ||
| 8152 |
|
9년 전 | 401 | |
| 8151 | 9년 전 | 404 | ||
| 8150 | 9년 전 | 497 | ||
| 8149 |
Jangfolk
|
9년 전 | 343 | |
| 8148 | 9년 전 | 163 | ||
| 8147 | 9년 전 | 370 | ||
| 8146 | 9년 전 | 429 | ||
| 8145 | 9년 전 | 375 | ||
| 8144 | 9년 전 | 341 | ||
| 8143 | 9년 전 | 188 | ||
| 8142 | 9년 전 | 425 | ||
| 8141 | 9년 전 | 378 | ||
| 8140 | 9년 전 | 925 | ||
| 8139 | 9년 전 | 254 | ||
| 8138 |
전갈자리남자
|
9년 전 | 383 | |
| 8137 | 9년 전 | 391 | ||
| 8136 | 9년 전 | 742 | ||
| 8135 |
|
9년 전 | 790 | |
| 8134 |
PlayPixel
|
9년 전 | 507 | |
| 8133 |
|
9년 전 | 431 | |
| 8132 | 9년 전 | 444 | ||
| 8131 | 9년 전 | 808 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기