PHP MySQL Multiples Querys

0

I have the following code where I run 3 Updates, the strange thing is that when executing it does not appear any error, that is to say that it executes everything well, but when consulting the BD it did not make any change, and if I remove 2 Querys and only left 1 there if you apply the changes.

<?php 
   $GLOBALS['conexion']->beginTransaction(); 

                    //NRO FISCAL #1
                    $query = "
                        UPDATE denominaciones
                        SET 
                        singular = 'RTN',
                        plural = 'RTN'
                        WHERE id_denominacion = 6;
                    ";

                    //NRO FISCAL #2
                    $query .= "
                        UPDATE denominaciones
                        SET 
                        singular = 'SAG',
                        plural = 'SAG'
                        WHERE id_denominacion = 7;
                    ";

                    //IMPUESTO
                    $query .= "
                        UPDATE denominaciones
                        SET 
                        singular = 'ISV',
                        plural = 'ISV'
                        WHERE id_denominacion = 8;
                    ";

                    $resultado_denom = $GLOBALS['conexion']->query($query);
                    if($resultado_denom){

                        print "info|Datos Procesados";
                        $GLOBALS['conexion']->commit();

                    }else{
                        print "error|Error al actualizar denominaciones";
                        $GLOBALS['conexion']->rollback();                           
                    }

   $GLOBALS['conexion']->closeCursor(); 
?>

Note: When making the connection with the BD I have the following configuration to allow multiple Querys, and even then it does not work.

            $this->conexion = new PDO("mysql:host=$host;port=$port;dbname=$db;charset=utf8",$user,$pw,
            array( 
                PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
            )
        );
    
asked by StevePHP 02.11.2018 в 15:36
source

0 answers