포인트 소멸? 초기화 ?

포인트 소멸? 초기화 ?

QA

포인트 소멸? 초기화 ?

본문

 

아래 는 전체회원 포인트 초기화 php 실행문 입니다.
혹시 여기서
전체회원 이 아닌. 특정 DB테이블. 시작 과 마지막 날짜 (EX: 2021-11월1일부터 ~ 2021-11월30) 까지 지급받은 포인트 초기화. 또는 소멸 가능할까요 ?

이벤트 포인트 지급테이블이 @event 로 되어있다는 가정입니다.
아니면

 

 

 

UPDATE {$g5['member_table']} SET']}

으로

해당 event테이블 설정기간 안에 지급된 포인트 들만 포인트 만료일 실행시키고싶습니다


<?php
include_once('./_common.php');
if ($is_admin != 'super') {
  alert('최고관리자만 가능합니다.', G5_URL);
}
// 포인트 전체 초기화
sql_query(" delete from {$g5['point_table']} ");
sql_query(" alter table {$g5['point_table']} auto_increment=1 ");
sql_query(" update {$g5['member_table']} set mb_point=0 ");
alert('초기화되었습니다.', G5_URL);
?>
 

이 질문에 댓글 쓰기 :

답변 1

update {$g5['member_table']} A inner join event B 

on A.멤버아이디 = B.멤버아이디

set mb_point = 0 

where B.완료날짜 between '2021-11-01 00:00:00' and '2021-11-31 23:59:59'

감사합니다.
그렇다면.
아이디 지정안하면.

event
테이블 에 있는.
between (해당기간) 날짜 값들 모두 변경될까요 ?


<?php
include_once('./_common.php');
if ($is_admin != 'super') {
  alert('최고관리자만 가능합니다.', G5_URL);
}
update {$g5['member_table']} A inner join event B 

set mb_point = 0 

where B.완료날짜 between '2021-11-01 00:00:00' and '2021-11-31 23:59:59'
alert('초기화되었습니다.', G5_URL);
?>

이렇게요

멤버 아이디가 특정 아이디가 아니에요
event 테이블이랑 member_table 의 join key 이기 때문에 있어야 됩니다.

A.member_id = B.member_id 이런식으로요

만약 특정 아이디를 지정하고 싶으면 where 조건뒤에 and A.member_id = 'aaaa' 이런식으로 쓰겠죠

친절하게 말씀해주셔서 감사합니다.
특정아이디를 사용할게 아니면.
아래처럼 구현해보도록 하겠습니다. 공부하는데.. 많은 도움이됩니다.. 혹시라도 틀린점있다면 잡아주시면 감사하겠습니다..


<?php
include_once('./_common.php');
if ($is_admin != 'super') {
  alert('최고관리자만 가능합니다.', G5_URL);
}
$sql = "update {$g5['member_table']} A inner join event B 

on A.member_id = B.member_id

set mb_point = 0 

where B.완료날짜 between '2021-11-01 00:00:00' and '2021-11-31 23:59:59'";
alert('초기화되었습니다.', G5_URL);
?>

db 에서는 일단 포인트 테이블 은 아래처럼 기제되어있습니다. 칼럼이 맞는지..ㅠㅠㅠㅠㅠ




po_id = 532
mb_id = admin
po_datetime = 2021-11-09 09:39:04
po_content = 2021-11-09 09:39:03에 이벤트 지급
po_point =  500
po_use_point = 0
po_expired = 0
po_expire_date = 9999-12-31
po_mb_point = 2502
po_rel_table = @event
po_rel_id = admin
po_rel_action = 2021-11-09 09:39:04

mb_id
mb_password
mb_name
mb_nick
mb_nick_date
mb_email
mb_homepage
mb_level
mb_sex
mb_birth
mb_tel
mb_hp
mb_certify
mb_adult
mb_dupinfo
mb_zip1
mb_zip2
mb_addr1
mb_addr2
mb_addr3
mb_addr_jibeon
mb_signature
mb_recommend
mb_point
mb_today_login
mb_login_ip
mb_datetime
mb_ip
mb_leave_date
mb_intercept_date
mb_email_certify
mb_email_certify2
mb_memo
mb_lost_certify
mb_mailling
mb_sms
mb_open
mb_open_date
mb_profile
mb_memo_call
mb_memo_cnt
mb_scrap_cnt
mb_1
mb_2
mb_3
mb_4
mb_5
mb_6
mb_7
mb_8
mb_9
mb_10
mb_is_noti
mb_noti_cnt


이렇게 있습니다!

아래처럼 하는게맞는지요^^?
친절하게 알려주셔서 너무너무 감사합니다.



<?php
include_once('./_common.php');
if ($is_admin != 'super') {
  alert('최고관리자만 가능합니다.', G5_URL);
}
$sql = "update {$g5['member_table']} A inner join event B 

on A.mb_id = B.mb_id

set mb_point = 0 

where B.완료날짜 po_expire_date '2021-11-01 00:00:00' and '2021-11-31 23:59:59'";
alert('초기화되었습니다.', G5_URL);
?>

앗 그럼 이렇게 하고.
sql 실행부분 어느부분에 넣어야할까용?ㅠㅠ
저는 이렇게하면 다되는줄..ㅠㅠ




<?php
include_once('./_common.php');
if ($is_admin != 'super') {
  alert('최고관리자만 가능합니다.', G5_URL);
}
$sql = "update {$g5['member_table']} A inner join event B 

on A.mb_id = B.mb_id

set mb_point = 0 

where B.po_expire_date between '2021-11-01 00:00:00' and '2021-11-31 23:59:59'";
alert('초기화되었습니다.', G5_URL);
?>

죄송합니당.
혼자.. 구글링. 책으로만 공부하다보니.. 완전 초보입니다..ㅠㅠ
문법 쿼리공부좀 더해야겠네용 ㅠㅠ

아래처럼 하고 실행 해봤으나. 포인트 변동이없습니당 엉엉엉 ㅠㅠㅠㅠㅠㅠ
무엇이 문제일까용..ㅠㅠㅠㅠㅠ



<?php
include_once('./_common.php');
if ($is_admin != 'super') {
  alert('최고관리자만 가능합니다.', G5_URL);
}
$sql = "update {$g5['member_table']} A inner join @event B 

on A.mb_id = B.mb_id

set mb_point = '0' 

where B.po_expire_date between '2021-11-01 00:00:00' and '2021-11-31 23:59:59'";

sql_query($sql);

alert('초기화되었습니다.', G5_URL);
?>

말씀해주신대로..

$sql = "update {$g5['member_table']} A inner join g5_point B

on A.mb_id = B.mb_id

set mb_point = '0'

where B.po_expire_date between '2021-11-01 00:00:00' and '2021-11-31 23:59:59'";

sql_query($sql);


처리를 하여도 .. 변동이없네용..ㅠㅠ;;

아니면 저의 생각으로 한번만들어봤는데..
이렇게도 될까요 ?



$sql = "UPDATE {$g5['g5_point']} SET po_expire_date='2021-11-31' WHERE po_rel_table='event'";

답변을 작성하시기 전에 로그인 해주세요.
전체 123,479 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT