od_id를 get으로 받아서 status를 변환 채택완료
x3keith
6년 전
조회 3,334
예를들어,
https://xxxxxxxx.com/change_status.php?od_id=2019102817455136
라는 링크를 통해서 접속하게 되면,
자동으로 주문 상태를 입금에서 -> 준비로 바꾸게 하는 페이지를 만들고 싶습니다.
</p>
<p><?php
$_GET["od_id"];
$od_id=$_GET["od_id"];
echo $od_id;</p>
<p>function change_status($od_id, $current_status, $change_status)
{
global $g5;
$current_status = "입금";
$change_status = "준비";</p>
<p>$sql = " update {$g5['g5_shop_order_table']} set od_status = '{$change_status}' where od_id = '{$od_id}' and od_status = '{$current_status}' ";
sql_query($sql, true);</p>
<p>$sql = " update {$g5['g5_shop_cart_table']} set ct_status = '{$change_status}' where od_id = '{$od_id}' and ct_status = '{$current_status}' ";
sql_query($sql, true);
}
?></p>
<p>
이런식으로 짜보았는데 변환이 되지는 않고있네요 ㅠ
어느 부분에서 문제인지 알려주시면 감사하겠습니다. 혹은 참고할만한 그누 파일을 알려주시면 감사하겠습니다!
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
6년 전
function change_status($od_id, $current_status, $change_status)
{
global $g5;
}
이 부분을 삭제하세요..
함수로 선언하지 않고 바로 실행하면 됩니다.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
x
x3keith
6년 전
e
eyekiss
6년 전
제일 상단에 아래 소스 추가하세요.
include_once('./_common.php');
include_once('./_common.php');
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
<?php
$_GET["od_id"];
$od_id=$_GET["od_id"];
echo $od_id;
$current_status = "입금";
$change_status = "준비";
$sql = " update {$g5['g5_shop_order_table']} set od_status = '{$change_status}' where od_id = '{$od_id}' and od_status = '{$current_status}' ";
sql_query($sql, true);
$sql = " update {$g5['g5_shop_cart_table']} set ct_status = '{$change_status}' where od_id = '{$od_id}' and ct_status = '{$current_status}' ";
sql_query($sql, true);
?>
[/code]
이렇게 수정 후 실행했는데 작동하지 않네요 ㅠㅠ
관리자 권한을 부여해야하는걸까요?