제가 이벤트 페이지를 만드는데 처음에는 아이디하나만 나오게하는게 막혀서 찾아보니 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' 이러케 하면 나올꺼 같은데요....
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5330 | 13년 전 | 777 | ||
| 5329 | 13년 전 | 715 | ||
| 5328 | 13년 전 | 645 | ||
| 5327 | 13년 전 | 888 | ||
| 5326 |
downmix
|
13년 전 | 1127 | |
| 5325 |
techer
|
13년 전 | 3153 | |
| 5324 |
techer
|
13년 전 | 981 | |
| 5323 | 13년 전 | 1192 | ||
| 5322 |
김준수사랑
|
13년 전 | 904 | |
| 5321 |
다케미카코
|
13년 전 | 765 | |
| 5320 |
|
13년 전 | 1002 | |
| 5319 |
한번잘해보자
|
13년 전 | 1017 | |
| 5318 |
|
13년 전 | 1280 | |
| 5317 |
techer
|
13년 전 | 2709 | |
| 5316 |
techer
|
13년 전 | 3153 | |
| 5315 | 13년 전 | 1183 | ||
| 5314 |
티즈코리아
|
13년 전 | 1235 | |
| 5313 | 13년 전 | 714 | ||
| 5312 |
|
13년 전 | 1879 | |
| 5311 |
innis
|
13년 전 | 778 | |
| 5310 | 13년 전 | 865 | ||
| 5309 |
changho
|
13년 전 | 665 | |
| 5308 |
|
13년 전 | 1370 | |
| 5307 |
|
13년 전 | 805 | |
| 5306 | 13년 전 | 1191 | ||
| 5305 |
세상속으로
|
13년 전 | 1170 | |
| 5304 | 13년 전 | 676 | ||
| 5303 | 13년 전 | 2264 | ||
| 5302 | 13년 전 | 1404 | ||
| 5301 | 13년 전 | 1119 | ||
| 5300 |
프로프리랜서
|
13년 전 | 1095 | |
| 5299 | 13년 전 | 878 | ||
| 5298 | 13년 전 | 685 | ||
| 5297 |
나랑사귈래
|
13년 전 | 615 | |
| 5296 | 13년 전 | 1344 | ||
| 5295 | 13년 전 | 1126 | ||
| 5294 | 13년 전 | 733 | ||
| 5293 |
|
13년 전 | 5828 | |
| 5292 |
|
13년 전 | 796 | |
| 5291 | 13년 전 | 623 | ||
| 5290 | 13년 전 | 563 | ||
| 5289 | 13년 전 | 658 | ||
| 5288 | 13년 전 | 1178 | ||
| 5287 | 13년 전 | 768 | ||
| 5286 | 13년 전 | 984 | ||
| 5285 | 13년 전 | 1332 | ||
| 5284 |
미스홍당무
|
13년 전 | 864 | |
| 5283 |
basketball
|
13년 전 | 1769 | |
| 5282 | 13년 전 | 801 | ||
| 5281 |
|
13년 전 | 814 | |
| 5280 | 13년 전 | 1222 | ||
| 5279 | 13년 전 | 1391 | ||
| 5278 |
크라이스트
|
13년 전 | 2058 | |
| 5277 |
|
13년 전 | 737 | |
| 5276 |
그누보드환자이송
|
13년 전 | 793 | |
| 5275 | 13년 전 | 709 | ||
| 5274 | 13년 전 | 1379 | ||
| 5273 | 13년 전 | 2012 | ||
| 5272 | 13년 전 | 1125 | ||
| 5271 | 13년 전 | 1439 | ||
| 5270 | 13년 전 | 812 | ||
| 5269 | 13년 전 | 536 | ||
| 5268 | 13년 전 | 672 | ||
| 5267 | 13년 전 | 1196 | ||
| 5266 | 13년 전 | 1864 | ||
| 5265 | 13년 전 | 1634 | ||
| 5264 |
크라이스트
|
13년 전 | 1216 | |
| 5263 |
|
13년 전 | 1269 | |
| 5262 |
제이티37
|
13년 전 | 591 | |
| 5261 |
|
13년 전 | 789 | |
| 5260 |
quenya
|
13년 전 | 2078 | |
| 5259 | 13년 전 | 715 | ||
| 5258 | 13년 전 | 735 | ||
| 5257 |
크라이스트
|
13년 전 | 4602 | |
| 5256 | 13년 전 | 1260 | ||
| 5255 | 13년 전 | 3273 | ||
| 5254 |
|
13년 전 | 715 | |
| 5253 | 13년 전 | 775 | ||
| 5252 | 13년 전 | 777 | ||
| 5251 | 13년 전 | 733 | ||
| 5250 |
dudn1114
|
13년 전 | 1296 | |
| 5249 | 13년 전 | 675 | ||
| 5248 | 13년 전 | 744 | ||
| 5247 | 13년 전 | 2087 | ||
| 5246 | 13년 전 | 514 | ||
| 5245 | 13년 전 | 2202 | ||
| 5244 | 13년 전 | 1465 | ||
| 5243 |
|
13년 전 | 977 | |
| 5242 | 13년 전 | 774 | ||
| 5241 | 13년 전 | 1855 | ||
| 5240 |
|
13년 전 | 511 | |
| 5239 | 13년 전 | 1040 | ||
| 5238 | 13년 전 | 1231 | ||
| 5237 | 13년 전 | 1124 | ||
| 5236 | 13년 전 | 593 | ||
| 5235 |
|
13년 전 | 772 | |
| 5234 |
뭐먹고살지ㅠ
|
13년 전 | 1033 | |
| 5233 | 13년 전 | 3601 | ||
| 5232 | 13년 전 | 3148 | ||
| 5231 | 13년 전 | 3735 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기