Saya tidak bisa meng update data ke database

Langsung ke topik pembahasan.... saya ingin membuat UPDATE status dari web <a href=' wobbly-panel.com '> wobbly-panel.com </a> ke web saya 4propanel.com, disini saya menggunakan APIKEY dari WOBBLY - PANEL untuk mengoper ke web saya... ini contoh APIKEYnya <a href=' https://wobbly-panel.com/api_status.txt '> https://wobbly-panel.com/api_status.txt </a> dan contoh kodingan saya di bawah ini


<?php
require_once("include/config.php");
$i=0;
$tampil = mysql_query("SELECT * FROM order_history WHERE provider = 'WP'");

while($data = mysql_fetch_array($tampil))
 {
 $i++;
$saldo = $data['price'];
$no = $data['order_id'];
$buyer= $data['buyer'];

//CEK ORDERAN
if($key = "dLtL0bO6KuF7gT2Gr6Zb"){ // your api key
$order_id = "$no"; // your order id
$postdata = "key=$key&action=status&order_id=$order_id";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://wobbly-panel.com/api.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$chresult = curl_exec($ch);
curl_close($ch);
$json_result = json_decode($chresult, true);


if($status == 'Pending'){
      $scmd = 'Pending';
      $update = "update order_history set status = '$scmd' where order_id = '$no'";
                $exe = mysql_query($update);
   } else if($status == 'Completed'){
      $scmd = 'Completed';
      $update = "update order_history set status = '$scmd' where order_id = '$no'";
                $exe = mysql_query($update);
   } else if($status == 'Partial'){
      $scmd = 'Partial';
      $update = "update order_history set status = '$scmd' where order_id = '$no'";
                $exe = mysql_query($update);
   } else if($status == 'Canceled'){
            $scmd = 'Canceled';
      $update = "update order_history set status = '$scmd' where order_id = '$no'";
      $exe = mysql_query($update);
      if($data['status'] == 'Canceled'){
            $scmd = 'Refunded';
      $simpan = mysql_query("UPDATE user SET balance=balance+$saldo WHERE username = '$buyer'");
      $simpan = mysql_query("UPDATE order_history SET status = '$scmd' WHERE order_id = '$no'");
      } else {
            $scmd = 'Error';
      $simpan = mysql_query("UPDATE order_history SET status = '$scmd' WHERE order_id = '$no'");
      }
   } else if($status == 'Processing'){
      $scmd = 'Processing';
      $update = "update order_history set status = '$scmd' where order_id = '$no'";
                $exe = mysql_query($update);

   } else {
      echo '-';
   }

if ($json_result['error'] == TRUE) {
	echo "GAGAL MENGECEK ORDERAN, PESAN : ".$json_result['error'];
	echo "<br>";
} else {
	echo "STATUS ORDER : ".$json_result['status'];
		echo "<br>";
}

}
}
?>

Ini hasil dari codingann saya,tetapi tidak berhasil ter update ke database Help me please

avatar riffshop
@riffshop

9 Kontribusi 0 Poin

Diperbarui 7 tahun yang lalu

1 Jawaban:

kalau saya , untuk mengecek query nya sudah benar atau belum... coba di tampilkan query update nya ke view terus copas dan coba di sql phpmyadmin, biasanya nanti ada pemberitahuan salah nya dimana(jika ada kesalahan)

avatar sukmaw
@sukmaw

340 Kontribusi 75 Poin

Dipost 7 tahun yang lalu

Login untuk ikut Jawaban