잘못된점이무엇일까요? 정보
잘못된점이무엇일까요?본문
기존에있던 g4_point 테이블을 똑같이 하나 복사햇습니다
테이블 이름은 g4_point1 이구요
그런데 문제는 g4_point1 에 데이터를 넣어야되는데 방법을 모르겟습니다.
insert_point($member[mb_id], $board[bo_read_point], "포인트차감", $bo_table, $wr_id, '읽기');
이 데이터를 g4_point1에 넣으려면 어떻게해야되나요?
이렇게 해봤는데 안되네요 ㅠㅠ 잘못된점이무엇일까요?
↓
1. config.php 에 한줄추가
$g4['point_table1'] = $g4['table_prefix'] . "point1"; // 포인트 테이블
2. lib/common.lib.php 에 insert_point1 추가
function insert_point1($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
if (!$config[cf_use_point]) { return 0; }
// 포인트가 없다면 업데이트 할 필요 없음
if ($point == 0) { return 0; }
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == "") { return 0; }
$mb = sql_fetch(" select mb_id from $g4[member_table] where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$sql = " select count(*) as cnt from $g4[point_table1]
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table1] where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
3. 포인트 인서트
insert_point1($member[mb_id], $board[bo_read_point], "포인트차감", $bo_table, $wr_id, '읽기');
테이블 이름은 g4_point1 이구요
그런데 문제는 g4_point1 에 데이터를 넣어야되는데 방법을 모르겟습니다.
insert_point($member[mb_id], $board[bo_read_point], "포인트차감", $bo_table, $wr_id, '읽기');
이 데이터를 g4_point1에 넣으려면 어떻게해야되나요?
이렇게 해봤는데 안되네요 ㅠㅠ 잘못된점이무엇일까요?
↓
1. config.php 에 한줄추가
$g4['point_table1'] = $g4['table_prefix'] . "point1"; // 포인트 테이블
2. lib/common.lib.php 에 insert_point1 추가
function insert_point1($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
if (!$config[cf_use_point]) { return 0; }
// 포인트가 없다면 업데이트 할 필요 없음
if ($point == 0) { return 0; }
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == "") { return 0; }
$mb = sql_fetch(" select mb_id from $g4[member_table] where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$sql = " select count(*) as cnt from $g4[point_table1]
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table1] where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
3. 포인트 인서트
insert_point1($member[mb_id], $board[bo_read_point], "포인트차감", $bo_table, $wr_id, '읽기');
댓글 전체
$sql = " insert into $g4[point_table] => $sql = " insert into $g4[point_table1]