제가 이벤트 페이지를 만드는데 처음에는 아이디하나만 나오게하는게 막혀서 찾아보니 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' 이러케 하면 나올꺼 같은데요....
게시판 목록
팁게시판
디자인과 관련된 유용한 정보를 공유하세요.
질문은 상단의 QA에서 해주시기 바랍니다.
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5902 | 9년 전 | 297 | ||
| 5901 | 9년 전 | 314 | ||
| 5900 | 9년 전 | 313 | ||
| 5899 | 9년 전 | 779 | ||
| 5898 | 9년 전 | 270 | ||
| 5897 | 9년 전 | 283 | ||
| 5896 | 9년 전 | 186 | ||
| 5895 | 9년 전 | 725 | ||
| 5894 | 9년 전 | 346 | ||
| 5893 | 9년 전 | 336 | ||
| 5892 | 9년 전 | 393 | ||
| 5891 | 9년 전 | 392 | ||
| 5890 | 9년 전 | 439 | ||
| 5889 | 9년 전 | 308 | ||
| 5888 | 9년 전 | 204 | ||
| 5887 | 9년 전 | 297 | ||
| 5886 | 9년 전 | 234 | ||
| 5885 | 9년 전 | 248 | ||
| 5884 | 9년 전 | 228 | ||
| 5883 | 9년 전 | 253 | ||
| 5882 | 9년 전 | 275 | ||
| 5881 | 9년 전 | 309 | ||
| 5880 | 9년 전 | 217 | ||
| 5879 | 9년 전 | 238 | ||
| 5878 | 9년 전 | 411 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기