point테이블에 특정 칼럼이 있으면 포인트 필드의 포인트만 증기시키고, 칼럼이 없으면 칼럼을 만들어야 되는데요,
SELECT COUNT(*)를 하고 fatch로 돌려서 할 수도 있지만..
$result = sql_query("update from $g4[point_table] set point=point+'$point'
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
if(!$result) sql_query("insert to $g4[point_table]~~~
이런식으로도 소스를 사용 할 수 있을까요? fatch를 쓰면 너무 지저분하고, 이게 하루에 수백번씩 접근되는 파일이라 최대한 깔끔하게 해야 되거든요. 오류 안생기게 한방에 해야되서.. 질문해 봅니다. 저런식의 소스도 가능한건가요??
SELECT COUNT(*)를 하고 fatch로 돌려서 할 수도 있지만..
$result = sql_query("update from $g4[point_table] set point=point+'$point'
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
if(!$result) sql_query("insert to $g4[point_table]~~~
이런식으로도 소스를 사용 할 수 있을까요? fatch를 쓰면 너무 지저분하고, 이게 하루에 수백번씩 접근되는 파일이라 최대한 깔끔하게 해야 되거든요. 오류 안생기게 한방에 해야되서.. 질문해 봅니다. 저런식의 소스도 가능한건가요??
댓글 3개
그런 문제는 다 해결 해 놨습니다. 제가 알고 싶은건 if(!$result)라는 조건문이 가능 한가입니다.
저렇게 안된다면
$sql = " select count(*) as cnt from $g4[point_table]
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]) {
update_point(231);
} else {
insert_point(231);
}
이런식으로 해야되구요.. 전 count방식을 사용하기 싫어서 그 부분만 해결 하려는 거거든요..
저렇게 안된다면
$sql = " select count(*) as cnt from $g4[point_table]
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]) {
update_point(231);
} else {
insert_point(231);
}
이런식으로 해야되구요.. 전 count방식을 사용하기 싫어서 그 부분만 해결 하려는 거거든요..
게시글 목록
| 번호 | 제목 |
|---|---|
| 284508 | |
| 284499 | |
| 284492 | |
| 284490 | |
| 284484 | |
| 284481 | |
| 284478 | |
| 284476 | |
| 284474 | |
| 284472 | |
| 284470 | |
| 284458 | |
| 284457 | |
| 284454 | |
| 284453 | |
| 284447 | |
| 284446 | |
| 284444 | |
| 284441 | |
| 284440 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기