-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecjabot.php
37 lines (31 loc) · 1.24 KB
/
execjabot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once('classes/conexao.class.php');
$clConexao = new Conexao;
$conn = $clConexao->Conectar();
$especie = $_REQUEST['especie'];
$sql = "select numtombo,taxoncompleto,codtestemunho,coletor,numcoleta,latitude,longitude,
pais,estado_prov as estado,cidade as municipio, siglacolecao as herbario
from
publicacao.extracao_jabot where latitude is not null and longitude is not null and
familia || ' ' || taxoncompleto ilike '%".$especie."%'";
$res = pg_exec($conn,$sql);
$totalregistroselecionados = pg_num_rows($res);
$arrayresposta = "[";
while ($row = pg_fetch_array($res))
{
$codigobarras= str_pad($row['codtestemunho'], 8, "0", STR_PAD_LEFT);
$sqlimagem = "select * from jabot.imagem where codigobarras = '".$codigobarras."' limit 1";
$resimagem = pg_exec($conn,$sqlimagem);
$rowimagem = pg_fetch_array($resimagem);
$servidor = $rowimagem ['servidor'];
$path = $rowimagem ['path'];
$arquivo = $rowimagem ['arquivo'];
$row['servidor'] = $rowimagem ['servidor'];
$row['path'] = $rowimagem ['path'];
$row['arquivo'] = $rowimagem ['arquivo'];
$json = json_encode($row);
$arrayresposta = $arrayresposta . $json . ',';
}
$arrayresposta = substr($arrayresposta, 0, -1) . ']';
print_r($arrayresposta);
?>