제가 이벤트 페이지를 만드는데 처음에는 아이디하나만 나오게하는게 막혀서 찾아보니 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년 전 | 177 | ||
| 8229 | 9년 전 | 157 | ||
| 8228 |
커네드커네드
|
9년 전 | 197 | |
| 8227 | 9년 전 | 240 | ||
| 8226 | 9년 전 | 255 | ||
| 8225 | 9년 전 | 234 | ||
| 8224 | 9년 전 | 245 | ||
| 8223 | 9년 전 | 219 | ||
| 8222 |
|
9년 전 | 283 | |
| 8221 | 9년 전 | 181 | ||
| 8220 | 9년 전 | 222 | ||
| 8219 | 9년 전 | 196 | ||
| 8218 | 9년 전 | 240 | ||
| 8217 |
star3840
|
9년 전 | 207 | |
| 8216 | 9년 전 | 271 | ||
| 8215 | 9년 전 | 218 | ||
| 8214 | 9년 전 | 328 | ||
| 8213 | 9년 전 | 286 | ||
| 8212 | 9년 전 | 198 | ||
| 8211 | 9년 전 | 366 | ||
| 8210 | 9년 전 | 367 | ||
| 8209 | 9년 전 | 442 | ||
| 8208 | 9년 전 | 333 | ||
| 8207 | 9년 전 | 341 | ||
| 8206 |
|
9년 전 | 285 | |
| 8205 | 9년 전 | 261 | ||
| 8204 | 9년 전 | 249 | ||
| 8203 | 9년 전 | 327 | ||
| 8202 | 9년 전 | 242 | ||
| 8201 | 9년 전 | 274 | ||
| 8200 | 9년 전 | 287 | ||
| 8199 | 9년 전 | 308 | ||
| 8198 | 9년 전 | 274 | ||
| 8197 | 9년 전 | 254 | ||
| 8196 | 9년 전 | 679 | ||
| 8195 | 9년 전 | 266 | ||
| 8194 | 9년 전 | 376 | ||
| 8193 | 9년 전 | 288 | ||
| 8192 | 9년 전 | 299 | ||
| 8191 | 9년 전 | 256 | ||
| 8190 | 9년 전 | 238 | ||
| 8189 | 9년 전 | 298 | ||
| 8188 | 9년 전 | 236 | ||
| 8187 | 9년 전 | 245 | ||
| 8186 | 9년 전 | 242 | ||
| 8185 | 9년 전 | 415 | ||
| 8184 | 9년 전 | 200 | ||
| 8183 | 9년 전 | 410 | ||
| 8182 | 9년 전 | 280 | ||
| 8181 | 9년 전 | 234 | ||
| 8180 | 9년 전 | 802 | ||
| 8179 | 9년 전 | 585 | ||
| 8178 | 9년 전 | 443 | ||
| 8177 |
kiplayer
|
9년 전 | 437 | |
| 8176 | 9년 전 | 470 | ||
| 8175 | 9년 전 | 357 | ||
| 8174 | 9년 전 | 349 | ||
| 8173 | 9년 전 | 436 | ||
| 8172 | 9년 전 | 317 | ||
| 8171 | 9년 전 | 278 | ||
| 8170 | 9년 전 | 402 | ||
| 8169 |
커네드커네드
|
9년 전 | 356 | |
| 8168 | 9년 전 | 436 | ||
| 8167 | 9년 전 | 426 | ||
| 8166 | 9년 전 | 321 | ||
| 8165 | 9년 전 | 266 | ||
| 8164 | 9년 전 | 402 | ||
| 8163 | 9년 전 | 406 | ||
| 8162 | 9년 전 | 392 | ||
| 8161 | 9년 전 | 406 | ||
| 8160 |
|
9년 전 | 627 | |
| 8159 | 9년 전 | 570 | ||
| 8158 | 9년 전 | 364 | ||
| 8157 | 9년 전 | 476 | ||
| 8156 | 9년 전 | 355 | ||
| 8155 | 9년 전 | 363 | ||
| 8154 |
00년생용띠
|
9년 전 | 696 | |
| 8153 | 9년 전 | 329 | ||
| 8152 |
|
9년 전 | 509 | |
| 8151 | 9년 전 | 507 | ||
| 8150 | 9년 전 | 620 | ||
| 8149 |
Jangfolk
|
9년 전 | 479 | |
| 8148 | 9년 전 | 293 | ||
| 8147 | 9년 전 | 476 | ||
| 8146 | 9년 전 | 557 | ||
| 8145 | 9년 전 | 516 | ||
| 8144 | 9년 전 | 484 | ||
| 8143 | 9년 전 | 312 | ||
| 8142 | 9년 전 | 524 | ||
| 8141 | 9년 전 | 467 | ||
| 8140 | 9년 전 | 1033 | ||
| 8139 | 9년 전 | 382 | ||
| 8138 |
전갈자리남자
|
9년 전 | 487 | |
| 8137 | 9년 전 | 522 | ||
| 8136 | 9년 전 | 851 | ||
| 8135 |
|
9년 전 | 895 | |
| 8134 |
PlayPixel
|
9년 전 | 632 | |
| 8133 |
|
9년 전 | 538 | |
| 8132 | 9년 전 | 580 | ||
| 8131 | 9년 전 | 937 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기