Bring data according to the ID of an option or a button of a list

1

Good community,

Beforehand, Thank you for taking your time to read, my query is as follows:

I have a table that contains some data:

[]

And a button to load a modal window:

But it is possible to bring the data according to the ID in which I want:

This is my query, but it should change according to the identifier that I have in the row of my HTML table,

  

something like when I have loaded in a Select with Options and every   Option has its ID and brings its data regarding the ID.

[code][color=#000000]
SELECT
pemp.id_puntoEmpresa,
pemp.nombre_punto,
pemp.direccion_punto,
pemp.telefono_punto,
pemp.email_punto,
pemp.descripcion_punto,
empr.id_empresa,
empr.nombre_empresa,
empr.nit,
ppto.id_parametroPunto,
ppto.nombreParametro

FROM puntoempresa pemp

INNER JOIN ciudades cdes
ON cdes.id_ciudad = pemp.id_ciudades_punto

INNER JOIN departamento dpto
ON dpto.id_departamento = cdes.id_departamento

INNER JOIN persona prna
ON prna.id_usuario_punto = pemp.id_puntoEmpresa

INNER JOIN tipodeusuario tusr
ON tusr.id_tipoDeUsuario = prna.id_tipoUsuario

INNER JOIN empresa empr
ON empr.id_empresa = prna.empresa_per

INNER JOIN parametropunto ppto
ON ppto.id_puntoEmpresa = pemp.id_puntoEmpresa

WHERE pemp.id_puntoEmpresa' = '$id_punto'
[/color][/code]

But the problem is that I do not know how to pass a variable to a GET method in Angular, and how to receive it in PHP.

I tried this way but it generates an error:

[code][color=#000000]
  
$data = json_decode(file_get_contents("php://input"));

if (count($data) > 0)
  {
     $idPunto        = mysqli_real_escape_string($mysqli, $data->id_punto);
 ....... (para luego pasarle la variable a la consulta)
 } 

[/color][/code]

This is my function to obtain the data from the table:

[code]
  $scope.importarDependencia = function(idPunto)
  {
    $scope.id_punto = idPunto;
    console.log($scope.id_punto);

    $http({
        method: 'GET',
        url: 'mainApp/Read/consultarDependencia.php'
      })
      .then(function successCallback(datosDependencias)
      {
        $scope.tableParametro = datosDependencias.data;
        console.log(datosDependencias);

      },function errorCallback(datosDependencias)
      {
        console.log("Error")
      });
  }
  $scope.importarDependencia();
[/code]

Thank you very much, I hope I have understood!

    
asked by jecorrales 20.05.2017 в 18:23
source

1 answer

0

with params you can send parameters in your get

$http({
        method: 'GET',
        url: 'mainApp/Read/consultarDependencia.php'
        params: {
         id: idPunto
        }
      })

in your php you can retrieve the parameters with $_GET

$_GET["id"]
    
answered by 20.05.2017 / 20:54
source