Introduction: There is this data that I will be retrieving from a third party and regardless of the outcome(whether successful or not ), will save the Information into a DB table.
I am able to successfully connect, retrieve and displayed the data but to save the data into the DB Table created for the purpose.
Steps taking so far
- I converted the sent data from the third party to a
JSON object
- I was able to displayed the JSON object on the Screen but couldn't save it into a DB table.
- I converted the JSON object to
SERIALIZE
object in PHP(which I learnt that is the way to go) 4. I was able to displayed the serialize object on the screen also but was unable to save the data to the DB table (Just like in step 2).
WORKINGS
$result2 = curl_exec($ch);
  // Convert returned statement to JSON encode
  $tranx = json_decode($result2);
  
  // Check if it returned a status call and if yes, proceed
  if(!$tranx->status){
    // there was an error from the API
    die('API returned error: ' . $tranx->message);
  }
  if('success' == $tranx->data->status) {
      $trans = serialize($tranx);
      $reference = serialize($tranx->data->reference);
      $integration = serialize($tranx->data->integration);
      $recipient = serialize($tranx->data->recipient);
      $status = serialize($tranx->data->status);
      $request = serialize($tranx->data->request);
      $transId = serialize($tranx->data->id);
      $createdAt = serialize($tranx->data->createdAt);
      
      // Insert the payment info into the payment_info 
      //table and update the members table
      $updateInsert = "UPDATE members SET referral_bonus_received=referral_bonus_received-$withdraw WHERE phone_number={$_SESSION['phone_number']};";
        // Insert transaction details into the db table
        $insert="INSERT INTO transaction_history (reference,intergration,amount,receipient,statuses,request,trans_id) VALUE (?,?,?,?,?,?,?);";
    //$detail= mysqli_query($con,$insertDetails);
    $stmt = $con->prepare($insert);
    $stmt->bind_param("sssssss", $reference, $integration, $amount, $recipient, $status, $request, $transId);
    $stmt->execute();
        // Check if it successfully insert into the DB and redirect if successful
    if($stmt==true){
      header("location:dashboard_n.php");
      exit();
     //echo "Real";
    }
This is just the portion of the code that matters.
What way can I make save this info into the db
