Welcome Guest, Not a member yet? Register   Sign In
CI4 Transaction not working on me
#1

PHP Code:
When a quoted data is receivedit gives an error and the undo operation does not work.
 this page have to 17 but getting error and not rollback. 
$stoklar
=json_decode(file_get_contents('http://myjsondata.com'));
        $db->transBegin();
        foreach ($stoklar->DATA as $key => $w) {
          for ($i=0$i <count($w) ; $i++) {
            $w[$i]=htmlentities(stripslashes($w[$i]));//error was here i should add ,ENT_QUOTES, "UTF-8" i know i but wanna see transaction
          }
          $PRICE_KDV=$w[0];
          $SALEABLE_STOCK=$w[1];
          $PRODUCT_ID=$w[2];
          $PRODUCT_NAME=$w[3];
          $BARCOD=$w[4];
          $PRODUCT_CODE=$w[5];
          $PRODUCT_DETAIL=$w[6];
          $db->query("INSERT INTO stoklar (PRICE_KDV, SALEABLE_STOCK, PRODUCT_ID, PRODUCT_NAME, BARCOD, PRODUCT_CODE, PRODUCT_DETAIL)
          values ('
$PRICE_KDV','$SALEABLE_STOCK','$PRODUCT_ID','$PRODUCT_NAME','$BARCOD','$PRODUCT_CODE','$PRODUCT_DETAIL')");
        }


        if ($db->transStatus() === false) {
            $db->transRollback();
        } else {
            $db->transCommit();
        
Reply


Messages In This Thread
CI4 Transaction not working on me - by dcyilmaz - 09-24-2021, 01:34 AM
RE: CI4 Transaction not working on me - by kenjis - 09-24-2021, 04:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB