Run PHP within the JavaScript Function [duplicate]

0

function queue (id) {

var idBanco = id;
console.log(variaveljs);

<?php
    $sql = "UPDATE 'tabelaclientespos' SET 'empresa' = '2' WHERE       
     'tabelaclientespos'.'Id' = idBanco";
    mysqli_query($conn,$sqlTempo);
?>

}

    
asked by anonymous 02.01.2019 / 19:45

1 answer

-1

Is not it better to do the other way around? Put the javascript function inside the tags and call it or not using PHP.

<?php
echo "<script>
          var idBanco = id;
          console.log(variaveljs);
          ".funcaophpaqui()."
          var x = ".$varphp."
      </script>";
?>
    
02.01.2019 / 19:49