<?php

  if( $Debug == 1 ){
    echo "Edit View";
  }

  $id             = $decoded['id'];

  if( $id ){

    $WHERE = "
      WHERE inf.Id != '0'
    ";

    //Id
    if( $id ){
      $WHERE .= "
        AND inf.id = '$id'
      ";
    }
    //End Id

    //Datos de Usuarios Tendero
    $Query = "
      SELECT
        inf.id,
        inf.nombre, inf.contenido
      FROM informacion inf
      $WHERE
    ";
    $Result = mysqli_query($mysqli, $Query);
	  $Inf = mysqli_fetch_assoc($Result);

    if( $Inf[id] ){

      $Data = array(
        'action'      => 'ok',
        'id_info'     => "$Inf[id]",
        'nombre'      => "$Inf[nombre]",
        'contenido'   => "$Inf[contenido]",
      );
      echo json_encode($Data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);

    }else{

      //Error uv-1 ( El Usuario no se encontró. )
      $Query = "
        SELECT
          err.Id, err.error, err.msn
        FROM api_errores err
        WHERE err.error = 'in-1'
      ";
      $Result = mysqli_query($mysqli, $Query);
      $Error = mysqli_fetch_assoc($Result);

      $Data = array(
        'action'      => 'error',
        'error'       => $Error[error],
        'error_msn'   => $Error[msn]
      );
      echo json_encode($Data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);

    }

  }

?>
