쪽지 2 - 2.0. 28 정보
쪽지 2 - 2.0. 28첨부파일
본문
엑스엠엘님 덕분에 가능하게 된 기능인데 대단하죠? ㅋㅋ...
문제는 정렬과 페이징 입니다. 정렬은 SQL에서 할 수 있지만 그경우에는 sub query를 써야
합니다. 아시겠지만 sub query를 지원 안하는 mysql 버젼이 대한민국 web hosting의 주류이기
때문에 sub query를 쓰지는 않으려고 SQL의 정렬은 포기 했습니다. 그거 쓰면 간단한데...
array_multisort를 몇시간 테스트 했지만 원하는 결과가 안나와서 포기 했습니다. ㅠ..ㅠ...
페이징을 넣는 것과 검색도 동일한 이유로 SQL에서 처리할 수 없고 array에서 처리해야지만
하는데 이게 생각보다 머리가 아프더라구요.
혹시 시간 되시는 분이 계시면 /skin/member/basic/memo2_memo_address_book.skin.php를
수정해서 알려주세요.
- 쪽지 2 주소록
/bbs/memo.php
/bbs/memo2.php
/skin/member/basic/memo2.skin.php
/skin/member/basic/memo2_memo_address_book.skin.php
* 관련 질문은 opencode.co.kr 에서 받습니다. 사이트의 여기저기를 뒤적여서 답하기 힘드러요.
문제는 정렬과 페이징 입니다. 정렬은 SQL에서 할 수 있지만 그경우에는 sub query를 써야
합니다. 아시겠지만 sub query를 지원 안하는 mysql 버젼이 대한민국 web hosting의 주류이기
때문에 sub query를 쓰지는 않으려고 SQL의 정렬은 포기 했습니다. 그거 쓰면 간단한데...
array_multisort를 몇시간 테스트 했지만 원하는 결과가 안나와서 포기 했습니다. ㅠ..ㅠ...
페이징을 넣는 것과 검색도 동일한 이유로 SQL에서 처리할 수 없고 array에서 처리해야지만
하는데 이게 생각보다 머리가 아프더라구요.
혹시 시간 되시는 분이 계시면 /skin/member/basic/memo2_memo_address_book.skin.php를
수정해서 알려주세요.
- 쪽지 2 주소록
/bbs/memo.php
/bbs/memo2.php
/skin/member/basic/memo2.skin.php
/skin/member/basic/memo2_memo_address_book.skin.php
* 관련 질문은 opencode.co.kr 에서 받습니다. 사이트의 여기저기를 뒤적여서 답하기 힘드러요.
추천
0
0
댓글 전체
얼른 감이 안오는데... 이 기능은 어느곳에 쓰이나요?
나의 메일박스 현황을 요약해서 보여주는 것이죠.
주소록 = 나와 쪽지 수발신 있었던 사람들 = 구글 스탈입니다.. ㅋㅋ
설치 해보시면 아~하고 금방 아실꺼에요
주소록 = 나와 쪽지 수발신 있었던 사람들 = 구글 스탈입니다.. ㅋㅋ
설치 해보시면 아~하고 금방 아실꺼에요
어지간한 subquery는 join으로 해결되는데... 한번 볼 수 있을까요?
} else if ($kind == "memo_address_book") { // 쪽지주소록
$sql = "
select 'recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_recv a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.me_recv_mb_id = '$member[mb_id]' group by a.me_send_mb_id
union all
select 'send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_send a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.me_send_mb_id = '$member[mb_id]' group by a.me_recv_mb_id
union all
select 'save_send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='send' group by a.me_recv_mb_id
union all
select 'save_recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='recv' group by a.me_send_mb_id
";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$list[$row[mb_id]][$row[type]] = $row[cnt];
$list[$row[mb_id]]['mb_id'] = $row[mb_id];
$list[$row[mb_id]]['mb_nick'] = $row[mb_nick];
if ($row[mb_nick])
$mb_nick = $row[mb_nick];
else
$mb_nick = "<font color=silver>정보없음</font>";
$name = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
$list[$row[mb_id]]['name'] = $name;
}
$sql = "
select 'recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_recv a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.me_recv_mb_id = '$member[mb_id]' group by a.me_send_mb_id
union all
select 'send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_send a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.me_send_mb_id = '$member[mb_id]' group by a.me_recv_mb_id
union all
select 'save_send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='send' group by a.me_recv_mb_id
union all
select 'save_recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='recv' group by a.me_send_mb_id
";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$list[$row[mb_id]][$row[type]] = $row[cnt];
$list[$row[mb_id]]['mb_id'] = $row[mb_id];
$list[$row[mb_id]]['mb_nick'] = $row[mb_nick];
if ($row[mb_nick])
$mb_nick = $row[mb_nick];
else
$mb_nick = "<font color=silver>정보없음</font>";
$name = get_sideview($row[mb_id], $row[mb_nick], $row[mb_email], $row[mb_homepage]);
$list[$row[mb_id]]['name'] = $name;
}
테이블 4개를 조인하는 방법이 있지 않을까요?
빈번하게 사용하는 기능이 아니라서... union all 정도로도 충분한거 같아요 ^^
디자인도 너무 멋지고 기능성도 좋은 것 같습니다.^^ 너무 좋습니다. 든든한 분들이 계셔서 감사합니다. 번창하세요~
Warning: Invalid argument supplied for foreach() in /free/home/widelang/html/skin/member/basic/memo2_memo_address_book.skin.php on line 63
주소록에서 오류뜹니다....
주소록에서 오류뜹니다....
$sql = "
select 'recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_recv a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.me_recv_mb_id = '$member[mb_id]' group by a.me_send_mb_id
union all
select 'send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_send a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.me_send_mb_id = '$member[mb_id]' group by a.me_recv_mb_id
union all
select 'save_send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='send' group by a.me_recv_mb_id
union all
select 'save_recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='recv' group by a.me_send_mb_id
";
제가 이부분에서 $g4[memo_recv_table] 이 아니라 g4_memo_recv와 같이 프로그램해서 그런거 아닌가요???
select 'recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_recv a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.me_recv_mb_id = '$member[mb_id]' group by a.me_send_mb_id
union all
select 'send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_send a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.me_send_mb_id = '$member[mb_id]' group by a.me_recv_mb_id
union all
select 'save_send' as type, a.me_recv_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_recv_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='send' group by a.me_recv_mb_id
union all
select 'save_recv' as type, a.me_send_mb_id as mb_id, count(*) as cnt, b.mb_nick, b.mb_email, b.mb_homepage from g4_memo_save a left join $g4[member_table] b on a.me_send_mb_id = b.mb_id where a.memo_owner = '$member[mb_id]' and memo_type='recv' group by a.me_send_mb_id
";
제가 이부분에서 $g4[memo_recv_table] 이 아니라 g4_memo_recv와 같이 프로그램해서 그런거 아닌가요???