제가 이벤트 페이지를 만드는데 처음에는 아이디하나만 나오게하는게 막혀서 찾아보니 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' 이러케 하면 나올꺼 같은데요....
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 467 | ||
| 7929 | 9년 전 | 405 | ||
| 7928 | 9년 전 | 479 | ||
| 7927 | 9년 전 | 382 | ||
| 7926 | 9년 전 | 693 | ||
| 7925 | 9년 전 | 415 | ||
| 7924 | 9년 전 | 401 | ||
| 7923 | 9년 전 | 386 | ||
| 7922 | 9년 전 | 417 | ||
| 7921 | 9년 전 | 434 | ||
| 7920 | 9년 전 | 344 | ||
| 7919 | 9년 전 | 354 | ||
| 7918 | 9년 전 | 508 | ||
| 7917 | 9년 전 | 363 | ||
| 7916 | 9년 전 | 450 | ||
| 7915 | 9년 전 | 459 | ||
| 7914 | 9년 전 | 471 | ||
| 7913 | 9년 전 | 648 | ||
| 7912 | 9년 전 | 476 | ||
| 7911 | 9년 전 | 401 | ||
| 7910 | 9년 전 | 458 | ||
| 7909 | 9년 전 | 566 | ||
| 7908 | 9년 전 | 507 | ||
| 7907 | 9년 전 | 434 | ||
| 7906 | 9년 전 | 458 | ||
| 7905 | 9년 전 | 433 | ||
| 7904 | 9년 전 | 417 | ||
| 7903 | 9년 전 | 427 | ||
| 7902 | 9년 전 | 598 | ||
| 7901 |
|
9년 전 | 770 | |
| 7900 | 9년 전 | 661 | ||
| 7899 | 9년 전 | 440 | ||
| 7898 | 9년 전 | 439 | ||
| 7897 | 9년 전 | 401 | ||
| 7896 | 9년 전 | 415 | ||
| 7895 | 9년 전 | 535 | ||
| 7894 | 9년 전 | 439 | ||
| 7893 | 9년 전 | 424 | ||
| 7892 | 9년 전 | 457 | ||
| 7891 | 9년 전 | 815 | ||
| 7890 | 9년 전 | 1232 | ||
| 7889 | 9년 전 | 770 | ||
| 7888 |
limsy1987
|
9년 전 | 579 | |
| 7887 | 9년 전 | 631 | ||
| 7886 | 9년 전 | 514 | ||
| 7885 | 9년 전 | 484 | ||
| 7884 | 9년 전 | 470 | ||
| 7883 | 9년 전 | 489 | ||
| 7882 | 9년 전 | 544 | ||
| 7881 | 9년 전 | 521 | ||
| 7880 | 9년 전 | 633 | ||
| 7879 | 9년 전 | 520 | ||
| 7878 | 9년 전 | 1294 | ||
| 7877 | 9년 전 | 816 | ||
| 7876 | 9년 전 | 563 | ||
| 7875 | 9년 전 | 632 | ||
| 7874 |
|
9년 전 | 833 | |
| 7873 | 9년 전 | 554 | ||
| 7872 | 9년 전 | 728 | ||
| 7871 | 9년 전 | 543 | ||
| 7870 | 9년 전 | 659 | ||
| 7869 | 9년 전 | 475 | ||
| 7868 | 9년 전 | 519 | ||
| 7867 | 9년 전 | 524 | ||
| 7866 | 9년 전 | 581 | ||
| 7865 | 9년 전 | 526 | ||
| 7864 | 10년 전 | 582 | ||
| 7863 | 10년 전 | 575 | ||
| 7862 | 10년 전 | 533 | ||
| 7861 | 10년 전 | 703 | ||
| 7860 | 10년 전 | 681 | ||
| 7859 | 10년 전 | 451 | ||
| 7858 | 10년 전 | 773 | ||
| 7857 | 10년 전 | 1157 | ||
| 7856 | 10년 전 | 579 | ||
| 7855 | 10년 전 | 817 | ||
| 7854 | 10년 전 | 755 | ||
| 7853 | 10년 전 | 654 | ||
| 7852 | 10년 전 | 570 | ||
| 7851 | 10년 전 | 582 | ||
| 7850 | 10년 전 | 648 | ||
| 7849 | 10년 전 | 413 | ||
| 7848 | 10년 전 | 473 | ||
| 7847 | 10년 전 | 729 | ||
| 7846 | 10년 전 | 503 | ||
| 7845 | 10년 전 | 487 | ||
| 7844 | 10년 전 | 441 | ||
| 7843 | 10년 전 | 487 | ||
| 7842 | 10년 전 | 466 | ||
| 7841 | 10년 전 | 431 | ||
| 7840 | 10년 전 | 450 | ||
| 7839 | 10년 전 | 512 | ||
| 7838 | 10년 전 | 557 | ||
| 7837 | 10년 전 | 389 | ||
| 7836 | 10년 전 | 446 | ||
| 7835 | 10년 전 | 528 | ||
| 7834 |
|
10년 전 | 1229 | |
| 7833 | 10년 전 | 496 | ||
| 7832 | 10년 전 | 468 | ||
| 7831 | 10년 전 | 632 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기