제가 이벤트 페이지를 만드는데 처음에는 아이디하나만 나오게하는게 막혀서 찾아보니 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' 이러케 하면 나올꺼 같은데요....
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 330 |
prosper
|
20년 전 | 2292 | |
| 329 |
prosper
|
20년 전 | 1920 | |
| 328 |
prosper
|
20년 전 | 1713 | |
| 327 | 20년 전 | 3780 | ||
| 326 | 20년 전 | 4866 | ||
| 325 |
hwatta
|
20년 전 | 2495 | |
| 324 |
|
20년 전 | 3160 | |
| 323 | 20년 전 | 5878 | ||
| 322 |
hwatta
|
20년 전 | 2866 | |
| 321 |
hwatta
|
20년 전 | 2338 | |
| 320 |
yesmoa
|
20년 전 | 4587 | |
| 319 | 20년 전 | 2701 | ||
| 318 | 20년 전 | 2247 | ||
| 317 |
kyodon
|
20년 전 | 2771 | |
| 316 | 20년 전 | 2593 | ||
| 315 |
|
20년 전 | 2893 | |
| 314 |
|
20년 전 | 3350 | |
| 313 |
|
20년 전 | 2658 | |
| 312 |
yesmoa
|
20년 전 | 4736 | |
| 311 | 20년 전 | 3288 | ||
| 310 |
홀로남은자
|
20년 전 | 4583 | |
| 309 | 20년 전 | 3016 | ||
| 308 | 20년 전 | 4147 | ||
| 307 | 20년 전 | 4384 | ||
| 306 | 20년 전 | 7046 | ||
| 305 | 20년 전 | 3878 | ||
| 304 | 20년 전 | 2777 | ||
| 303 |
크리스탈처럼
|
20년 전 | 4417 | |
| 302 | 20년 전 | 2221 | ||
| 301 |
|
20년 전 | 4340 | |
| 300 | 20년 전 | 3820 | ||
| 299 | 20년 전 | 2642 | ||
| 298 | 20년 전 | 4851 | ||
| 297 |
|
20년 전 | 2542 | |
| 296 | 20년 전 | 4548 | ||
| 295 | 20년 전 | 3581 | ||
| 294 | 20년 전 | 3599 | ||
| 293 | 20년 전 | 3830 | ||
| 292 | 20년 전 | 3226 | ||
| 291 |
yesmoa
|
20년 전 | 5962 | |
| 290 | 20년 전 | 2951 | ||
| 289 | 20년 전 | 5876 | ||
| 288 |
|
20년 전 | 2391 | |
| 287 |
|
20년 전 | 1822 | |
| 286 |
|
20년 전 | 2161 | |
| 285 |
|
20년 전 | 3552 | |
| 284 |
|
20년 전 | 2047 | |
| 283 |
|
20년 전 | 4410 | |
| 282 | 20년 전 | 3391 | ||
| 281 |
|
20년 전 | 2222 | |
| 280 |
|
20년 전 | 7824 | |
| 279 | 20년 전 | 5576 | ||
| 278 | 20년 전 | 3008 | ||
| 277 |
|
20년 전 | 5579 | |
| 276 | 20년 전 | 2372 | ||
| 275 | 20년 전 | 2629 | ||
| 274 | 20년 전 | 2409 | ||
| 273 | 20년 전 | 2244 | ||
| 272 | 20년 전 | 2173 | ||
| 271 | 20년 전 | 2647 | ||
| 270 | 20년 전 | 2677 | ||
| 269 | 20년 전 | 2518 | ||
| 268 | 20년 전 | 2706 | ||
| 267 | 20년 전 | 2390 | ||
| 266 | 20년 전 | 2582 | ||
| 265 | 20년 전 | 3525 | ||
| 264 |
|
20년 전 | 5385 | |
| 263 |
|
20년 전 | 3751 | |
| 262 | 20년 전 | 3205 | ||
| 261 |
허저비
|
20년 전 | 5951 | |
| 260 |
|
20년 전 | 5726 | |
| 259 | 20년 전 | 4154 | ||
| 258 | 20년 전 | 2387 | ||
| 257 | 20년 전 | 3212 | ||
| 256 | 20년 전 | 1924 | ||
| 255 | 20년 전 | 1595 | ||
| 254 | 20년 전 | 3165 | ||
| 253 | 20년 전 | 3558 | ||
| 252 | 20년 전 | 5142 | ||
| 251 | 20년 전 | 5834 | ||
| 250 | 20년 전 | 3696 | ||
| 249 | 20년 전 | 5037 | ||
| 248 | 20년 전 | 3305 | ||
| 247 | 20년 전 | 3661 | ||
| 246 |
|
20년 전 | 7969 | |
| 245 |
|
20년 전 | 5933 | |
| 244 | 20년 전 | 4503 | ||
| 243 |
|
20년 전 | 4080 | |
| 242 | 20년 전 | 2811 | ||
| 241 | 20년 전 | 2758 | ||
| 240 | 20년 전 | 2396 | ||
| 239 | 20년 전 | 1684 | ||
| 238 |
아우겐나이스
|
20년 전 | 2291 | |
| 237 |
email
|
20년 전 | 3706 | |
| 236 | 20년 전 | 4188 | ||
| 235 | 20년 전 | 10479 | ||
| 234 | 20년 전 | 5090 | ||
| 233 | 20년 전 | 3393 | ||
| 232 | 20년 전 | 3233 | ||
| 231 | 20년 전 | 3877 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기